GH-1743 selected instance can be null - do not assume it isn't

This fixes a crash when closing settings and not having any selected instance.
This commit is contained in:
Petr Mrázek 2016-12-07 01:19:03 +01:00
parent 035bdc7576
commit 2517d2c84d

View File

@ -682,7 +682,7 @@ void MainWindow::showInstanceContextMenu(const QPoint &pos)
void MainWindow::updateToolsMenu()
{
QToolButton *launchButton = dynamic_cast<QToolButton*>(ui->instanceToolBar->widgetForAction(ui->actionLaunchInstance));
if(m_selectedInstance->isRunning())
if(!m_selectedInstance || m_selectedInstance->isRunning())
{
ui->actionLaunchInstance->setMenu(nullptr);
launchButton->setPopupMode(QToolButton::InstantPopup);