Skip to content

Commit 27143e9

Browse files
committed
Don't deref potential null
1 parent 847b449 commit 27143e9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/AppInstallerCLICore/Workflows/PortableFlow.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,10 @@ namespace AppInstaller::CLI::Workflow
111111
{
112112
Manifest::ScopeEnum scope = Manifest::ScopeEnum::Unknown;
113113
bool isUpdate = WI_IsFlagSet(context.GetFlags(), Execution::ContextFlag::InstallerExecutionUseUpdate);
114-
if (isUpdate)
114+
auto installedVersion = context.Get<Execution::Data::InstalledPackageVersion>();
115+
if (isUpdate && installedVersion)
115116
{
116-
IPackageVersion::Metadata installationMetadata = context.Get<Execution::Data::InstalledPackageVersion>()->GetMetadata();
117+
IPackageVersion::Metadata installationMetadata = installedVersion->GetMetadata();
117118
auto installerScopeItr = installationMetadata.find(Repository::PackageVersionMetadata::InstalledScope);
118119
if (installerScopeItr != installationMetadata.end())
119120
{

0 commit comments

Comments
 (0)