diff options
author | Tim Jenssen <tim.jenssen@nokia.com> | 2011-08-22 15:07:08 +0200 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@nokia.com> | 2011-08-22 15:18:45 +0200 |
commit | 68a367649a25b38cf69ec9dcacddc0e921c5b4f2 (patch) | |
tree | b1400dd774473a86045c02fb91717fa5fa792054 /installerbuilder | |
parent | 0744566bdadfc301f1f429bc21bdde24ce2964f7 (diff) |
catch isDefault and isAutoDependOn errors from script
Change-Id: I565d79c6e2d668f629700b0e62ce34eaf9651f59
Reviewed-on: http://codereview.qt.nokia.com/3322
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Niels Weber <niels.2.weber@nokia.com>
Reviewed-by: Karsten Heimrich <karsten.heimrich@nokia.com>
Diffstat (limited to 'installerbuilder')
-rw-r--r-- | installerbuilder/libinstaller/component.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/installerbuilder/libinstaller/component.cpp b/installerbuilder/libinstaller/component.cpp index 242db5054..b63020d32 100644 --- a/installerbuilder/libinstaller/component.cpp +++ b/installerbuilder/libinstaller/component.cpp @@ -926,7 +926,16 @@ bool Component::isAutoDependOn(const QSet<QString> &componentsToInstall) const { // The script can override this method and determines if the component needs to be installed. if (value(scAutoDependOn).compare(QLatin1String("script"), Qt::CaseInsensitive) == 0) { - const QScriptValue valueFromScript = callScriptMethod(QLatin1String("isAutoDependOn")); + QScriptValue valueFromScript; + try { + valueFromScript = callScriptMethod(QLatin1String("isAutoDependOn")); + } catch (const Error &error) { + MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(), + QLatin1String("isAutoDependOnError"), tr("Can't resolve isAutoDependOn in %1" + ).arg(name()), error.message()); + return false; + } + if (valueFromScript.isValid()) return valueFromScript.toBool(); verbose() << "value from script is not valid " << std::endl; @@ -963,7 +972,15 @@ bool Component::isDefault() const { // the script can override this method if (value(scDefault).compare(QLatin1String("script"), Qt::CaseInsensitive) == 0) { - const QScriptValue valueFromScript = callScriptMethod(QLatin1String("isDefault")); + QScriptValue valueFromScript; + try { + valueFromScript = callScriptMethod(QLatin1String("isDefault")); + } catch (const Error &error) { + MessageBoxHandler::critical(MessageBoxHandler::currentBestSuitParent(), + QLatin1String("isDefaultError"), tr("Can't resolve isDefault in %1").arg(name()), + error.message()); + return false; + } if (valueFromScript.isValid()) return valueFromScript.toBool(); verbose() << "value from script is not valid " << std::endl; |