forked from qt-creator/qt-creator
Fix crash when pressing wrong shortcuts in welcome mode
Fixes: QTCREATORBUG-21302 Change-Id: Ib7e50f3cbd3e6e8f995b8cda7ad965f0cafde511 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -127,12 +127,18 @@ ProjectWelcomePage::ProjectWelcomePage()
|
|||||||
auto act = new QAction(tr("Open Session #%1").arg(i), this);
|
auto act = new QAction(tr("Open Session #%1").arg(i), this);
|
||||||
Command *cmd = ActionManager::registerAction(act, sessionBase.withSuffix(i), welcomeContext);
|
Command *cmd = ActionManager::registerAction(act, sessionBase.withSuffix(i), welcomeContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence((useMacShortcuts ? tr("Ctrl+Meta+%1") : tr("Ctrl+Alt+%1")).arg(i)));
|
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);
|
act = new QAction(tr("Open Recent Project #%1").arg(i), this);
|
||||||
cmd = ActionManager::registerAction(act, projectBase.withSuffix(i), welcomeContext);
|
cmd = ActionManager::registerAction(act, projectBase.withSuffix(i), welcomeContext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+%1").arg(i)));
|
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);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user