Skip to content

Commit ae7b476

Browse files
authored
Fix AV in portable flow (#5526)
## Change Only use the installed version's scope when we have one to use.
1 parent ab7417e commit ae7b476

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/AppInstallerCLICore/Workflows/PortableFlow.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,14 @@ 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+
std::shared_ptr<Repository::IPackageVersion> installedVersion;
115+
if (context.Contains(Execution::Data::InstalledPackageVersion))
115116
{
116-
IPackageVersion::Metadata installationMetadata = context.Get<Execution::Data::InstalledPackageVersion>()->GetMetadata();
117+
installedVersion = context.Get<Execution::Data::InstalledPackageVersion>();
118+
}
119+
if (isUpdate && installedVersion)
120+
{
121+
IPackageVersion::Metadata installationMetadata = installedVersion->GetMetadata();
117122
auto installerScopeItr = installationMetadata.find(Repository::PackageVersionMetadata::InstalledScope);
118123
if (installerScopeItr != installationMetadata.end())
119124
{

0 commit comments

Comments
 (0)