summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Griebl <robert.griebl@qt.io>2021-07-27 14:56:02 +0200
committerRobert Griebl <robert.griebl@qt.io>2021-07-27 20:11:33 +0200
commitde0a31e9e0d8f018906729d7c74e2a63ce4a5f40 (patch)
treeae4e40d45ada67693c8811b967cdcfa1795449fe
parent22c874703490ab0e1d0dea81f6f7d3efe7f94684 (diff)
downloadqtapplicationmanager-de0a31e9e0d8f018906729d7c74e2a63ce4a5f40.tar.gz
Fix the check for duplicate built-in packages
We only tested against an empty list instead of the list of currently parsed packages. Change-Id: I0d74a87103b82d43ea293c1bc3e314d2693298a3 Pick-to: 5.15 Reviewed-by: Dominik Holland <dominik.holland@qt.io>
-rw-r--r--src/manager-lib/packagemanager.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/manager-lib/packagemanager.cpp b/src/manager-lib/packagemanager.cpp
index 1dab54ba..2546f9ee 100644
--- a/src/manager-lib/packagemanager.cpp
+++ b/src/manager-lib/packagemanager.cpp
@@ -327,10 +327,11 @@ void PackageManager::registerPackages()
// map all the built-in packages first
const auto builtinPackages = d->database->builtInPackages();
for (auto packageInfo : builtinPackages) {
- if (Package *existingPackage = fromId(packageInfo->id())) {
+ auto existingPackageInfos = pkgs.value(packageInfo->id());
+ if (existingPackageInfos.first) {
throw Exception(Error::Package, "Found more than one built-in package with id '%1': here: %2 and there: %3")
.arg(packageInfo->id())
- .arg(existingPackage->info()->manifestPath())
+ .arg(existingPackageInfos.first->manifestPath())
.arg(packageInfo->manifestPath());
}
pkgs.insert(packageInfo->id(), qMakePair(packageInfo, nullptr));