aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-09-05 12:33:28 +0200
committerJoerg Bornemann <joerg.bornemann@digia.com>2014-09-26 17:49:56 +0200
commitf239d9cb4a6e8417a292529f3b0f48a24de19305 (patch)
tree1b79b4c974879c31b47ec4efb80bb24ee3553f0c
parentebc11e4612444bce428bbacb91f0f26906666749 (diff)
Check whether profiles listed in Product.profiles actually exist.
Otherwise people will get cryptic messages about missing properties if they mistype a profile name. Change-Id: I732a7ab6a5c0f79ddee7d4f028c2514aec265d0a Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
-rw-r--r--src/lib/corelib/language/moduleloader.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/corelib/language/moduleloader.cpp b/src/lib/corelib/language/moduleloader.cpp
index d16f2469d..0070544d3 100644
--- a/src/lib/corelib/language/moduleloader.cpp
+++ b/src/lib/corelib/language/moduleloader.cpp
@@ -358,7 +358,15 @@ QList<Item *> ModuleLoader::multiplexProductItem(Item *productItem)
QList<Item *> additionalProductItems;
const QString profileKey = QLatin1String("profile");
productItem->setProperty(profileKey, VariantValue::create(profileNames.first()));
- for (int i = 1; i < profileNames.count(); ++i) {
+ Settings settings(m_parameters.settingsDirectory());
+ for (int i = 0; i < profileNames.count(); ++i) {
+ Profile profile(profileNames.at(i), &settings);
+ if (!profile.exists()) {
+ throw ErrorInfo(Tr::tr("The profile '%1' does not exist.").arg(profile.name()),
+ productItem->location()); // TODO: profilesValue->location() is invalid, why?
+ }
+ if (i == 0)
+ continue; // We use the original item for the first profile.
Item * const cloned = productItem->clone(productItem->pool());
cloned->setProperty(profileKey, VariantValue::create(profileNames.at(i)));
additionalProductItems << cloned;