commit a05950299a3c028128ec30a9de168c61400badff
parent 1cc58ce1996810b6f2c639b74451f476c7b58244
Author: sreadingMSFT <74242768+sreadingMSFT@users.noreply.github.com>
Date: Wed, 30 Jun 2021 08:54:35 -0700
Fix standalone installed source. (#1199)
Diffstat:
1 file changed, 25 insertions(+), 21 deletions(-)
diff --git a/src/AppInstallerRepositoryCore/RepositorySource.cpp b/src/AppInstallerRepositoryCore/RepositorySource.cpp
@@ -996,31 +996,35 @@ namespace AppInstaller::Repository
// Get the details again by name from the source list because SaveMetadata only updates the LastUpdateTime
// if the details came from the same instance of the list that's being saved.
- SourceListInternal sourceList;
- auto source = sourceList.GetSource(details.Name);
- if (!source)
- {
- AICLI_LOG(Repo, Info, << "Named source no longer found. Source may have been removed by the user: " << details.Name);
- return {};
- }
- else if (source->IsTombstone)
- {
- AICLI_LOG(Repo, Info, << "Named source no longer found. Source was tombstoned: " << details.Name);
- return {};
- }
- if (ShouldUpdateBeforeOpen(*source))
+ // Some sources that do not need updating like the Installed source, do not have Name values.
+ if (!details.Name.empty())
{
- try
+ SourceListInternal sourceList;
+ auto source = sourceList.GetSource(details.Name);
+ if (!source)
{
- if (BackgroundUpdateSourceFromDetails(*source, progress))
- {
- sourceList.SaveMetadata();
- }
+ AICLI_LOG(Repo, Info, << "Named source no longer found. Source may have been removed by the user: " << details.Name);
+ return {};
+ }
+ else if (source->IsTombstone)
+ {
+ AICLI_LOG(Repo, Info, << "Named source no longer found. Source was tombstoned: " << details.Name);
+ return {};
}
- catch (...)
+ if (ShouldUpdateBeforeOpen(*source))
{
- AICLI_LOG(Repo, Warning, << "Failed to update source: " << details.Name);
- result.SourcesWithUpdateFailure.emplace_back(*source);
+ try
+ {
+ if (BackgroundUpdateSourceFromDetails(*source, progress))
+ {
+ sourceList.SaveMetadata();
+ }
+ }
+ catch (...)
+ {
+ AICLI_LOG(Repo, Warning, << "Failed to update source: " << details.Name);
+ result.SourcesWithUpdateFailure.emplace_back(*source);
+ }
}
}