diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 46cbc7ba76b..1b34ae84fcd 100644 --- a/src/plugins/debugger/debuggerdialogs.cpp +++ b/src/plugins/debugger/debuggerdialogs.cpp @@ -375,6 +375,7 @@ bool StartApplicationDialog::run(QWidget *parent, QSettings *settings, DebuggerS } Profile *profile = dialog.d->profileChooser->currentProfile(); + QTC_ASSERT(profile, return false); fillParameters(sp, profile); sp->executable = newParameters.localExecutable; diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 6c254b27a2e..87ae97d8ee0 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -1702,10 +1702,12 @@ void DebuggerPluginPrivate::attachToQmlPort() if (dlg.exec() != QDialog::Accepted) return; + Profile *profile = dlg.profile(); + QTC_ASSERT(profile, return); setConfigValue(_("LastQmlServerPort"), dlg.port()); - setConfigValue(_("LastProfile"), dlg.profile()->id().toString()); + setConfigValue(_("LastProfile"), profile->id().toString()); - fillParameters(&sp, dlg.profile()); + fillParameters(&sp, profile); sp.qmlServerAddress = sp.connParams.host; sp.qmlServerPort = dlg.port(); sp.startMode = AttachToRemoteProcess; diff --git a/src/plugins/debugger/debuggerprofileinformation.cpp b/src/plugins/debugger/debuggerprofileinformation.cpp index bda8c41c5e0..f794bbc6342 100644 --- a/src/plugins/debugger/debuggerprofileinformation.cpp +++ b/src/plugins/debugger/debuggerprofileinformation.cpp @@ -37,6 +37,7 @@ #include #include +#include #include #include @@ -213,11 +214,12 @@ ProfileInformation::ItemList DebuggerProfileInformation::toUserOutput(Profile *p FileName DebuggerProfileInformation::debuggerCommand(const Profile *p) { - return FileName::fromString(p->value(Core::Id(DEBUGGER_INFORMATION)).toString()); + return FileName::fromString(p ? p->value(Core::Id(DEBUGGER_INFORMATION)).toString() : QString()); } void DebuggerProfileInformation::setDebuggerCommand(Profile *p, const FileName &command) { + QTC_ASSERT(p, return); p->setValue(Core::Id(DEBUGGER_INFORMATION), command.toString()); } diff --git a/src/plugins/projectexplorer/profilechooser.cpp b/src/plugins/projectexplorer/profilechooser.cpp index 03d602efe77..da73a5f1465 100644 --- a/src/plugins/projectexplorer/profilechooser.cpp +++ b/src/plugins/projectexplorer/profilechooser.cpp @@ -50,6 +50,8 @@ void ProfileChooser::onCurrentIndexChanged(int index) { if (Profile *profile = profileAt(index)) setToolTip(profile->toHtml()); + else + setToolTip(QString()); } void ProfileChooser::populate(unsigned flags) @@ -78,7 +80,8 @@ void ProfileChooser::populate(unsigned flags) Profile *ProfileChooser::currentProfile() const { - return profileAt(currentIndex()); + const int index = currentIndex(); + return index == -1 ? 0 : profileAt(index); } void ProfileChooser::setCurrentProfileId(Core::Id id) @@ -93,7 +96,8 @@ void ProfileChooser::setCurrentProfileId(Core::Id id) Core::Id ProfileChooser::currentProfileId() const { - return profileAt(currentIndex())->id(); + Profile *profile = currentProfile(); + return profile ? profile->id() : Core::Id(); } Profile *ProfileChooser::profileAt(int index) const