Commit 1c401481 authored by Christian Kamm's avatar Christian Kamm Committed by Kai Koehne

QmlProject: Don't crash if there's no active target.

Change-Id: I0fd95f0d388f4ba06936ec9164a91a3c53a0f005
Reviewed-on: http://codereview.qt.nokia.com/104Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarKai Koehne <kai.koehne@nokia.com>
parent b8734dd7
...@@ -144,9 +144,11 @@ void QmlProject::refresh(RefreshOptions options) ...@@ -144,9 +144,11 @@ void QmlProject::refresh(RefreshOptions options)
pinfo.sourceFiles = files(); pinfo.sourceFiles = files();
pinfo.importPaths = importPaths(); pinfo.importPaths = importPaths();
QtSupport::BaseQtVersion *version = 0; QtSupport::BaseQtVersion *version = 0;
if (QmlProjectRunConfiguration *rc = qobject_cast<QmlProjectRunConfiguration *>(activeTarget()->activeRunConfiguration())) if (activeTarget()) {
version = rc->qtVersion(); if (QmlProjectRunConfiguration *rc = qobject_cast<QmlProjectRunConfiguration *>(activeTarget()->activeRunConfiguration()))
QtSupport::QmlDumpTool::pathAndEnvironment(this, version, false, &pinfo.qmlDumpPath, &pinfo.qmlDumpEnvironment); version = rc->qtVersion();
QtSupport::QmlDumpTool::pathAndEnvironment(this, version, false, &pinfo.qmlDumpPath, &pinfo.qmlDumpEnvironment);
}
m_modelManager->updateProjectInfo(pinfo); m_modelManager->updateProjectInfo(pinfo);
} }
...@@ -289,9 +291,11 @@ bool QmlProject::fromMap(const QVariantMap &map) ...@@ -289,9 +291,11 @@ bool QmlProject::fromMap(const QVariantMap &map)
refresh(Everything); refresh(Everything);
// FIXME workaround to guarantee that run/debug actions are enabled if a valid file exists // FIXME workaround to guarantee that run/debug actions are enabled if a valid file exists
QmlProjectRunConfiguration *runConfig = qobject_cast<QmlProjectRunConfiguration*>(activeTarget()->activeRunConfiguration()); if (activeTarget()) {
if (runConfig) QmlProjectRunConfiguration *runConfig = qobject_cast<QmlProjectRunConfiguration*>(activeTarget()->activeRunConfiguration());
runConfig->changeCurrentFile(0); if (runConfig)
runConfig->changeCurrentFile(0);
}
return true; return true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment