diff options
author | Eike Ziller <eike.ziller@qt.io> | 2018-10-18 15:14:48 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2018-10-19 08:29:31 +0000 |
commit | d810c5b77ffc0b09f3ded01cd2758dd13211b33c (patch) | |
tree | 71548a22e6a54d2cb80c6af57abd0e123ec4b665 /src/plugins | |
parent | 4dbc62a47e3e43e489b5a3b89f308bf8292285d9 (diff) |
Fix crash when pressing wrong shortcuts in welcome mode
Fixes: QTCREATORBUG-21302
Change-Id: Ib7e50f3cbd3e6e8f995b8cda7ad965f0cafde511
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/projectexplorer/projectwelcomepage.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/plugins/projectexplorer/projectwelcomepage.cpp b/src/plugins/projectexplorer/projectwelcomepage.cpp index 9cf3167a24..08842aabea 100644 --- a/src/plugins/projectexplorer/projectwelcomepage.cpp +++ b/src/plugins/projectexplorer/projectwelcomepage.cpp @@ -127,12 +127,18 @@ ProjectWelcomePage::ProjectWelcomePage() auto act = new QAction(tr("Open Session #%1").arg(i), this); Command *cmd = ActionManager::registerAction(act, sessionBase.withSuffix(i), welcomeContext); cmd->setDefaultKeySequence(QKeySequence((useMacShortcuts ? tr("Ctrl+Meta+%1") : tr("Ctrl+Alt+%1")).arg(i))); - connect(act, &QAction::triggered, this, [this, i] { openSessionAt(i - 1); }); + connect(act, &QAction::triggered, this, [this, i] { + if (i <= m_sessionModel->rowCount()) + openSessionAt(i - 1); + }); act = new QAction(tr("Open Recent Project #%1").arg(i), this); cmd = ActionManager::registerAction(act, projectBase.withSuffix(i), welcomeContext); cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+%1").arg(i))); - connect(act, &QAction::triggered, this, [this, i] { openProjectAt(i - 1); }); + connect(act, &QAction::triggered, this, [this, i] { + if (i <= m_projectModel->rowCount(QModelIndex())) + openProjectAt(i - 1); + }); } } |