diff --git a/src/plugins/debugger/debuggerdialogs.cpp b/src/plugins/debugger/debuggerdialogs.cpp index 46cbc7ba76b9f7d1d37ec39d883923a40d73be3c..1b34ae84fcd2ea793a252380295a05475a8cb01f 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 6c254b27a2e1a49088aa50e275295573fd9d5846..87ae97d8ee09315514bf4d34da319e48be0ac530 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 bda8c41c5e0897d64f24c7404b4346892f1abd48..f794bbc6342b05c4aa65e28f7982293fb5350e9e 100644 --- a/src/plugins/debugger/debuggerprofileinformation.cpp +++ b/src/plugins/debugger/debuggerprofileinformation.cpp @@ -37,6 +37,7 @@ #include <projectexplorer/toolchain.h> #include <utils/environment.h> +#include <utils/qtcassert.h> #include <QDir> #include <QPair> @@ -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 03d602efe774fe8f6475bbf45cd2a5895e7c9910..da73a5f1465f9ab308aebf35edaaf2976270b3f7 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