Qt: add nullptr checks in msg_dialog_frame

This commit is contained in:
Megamouse 2021-07-29 00:40:39 +02:00
parent 2efc4812d7
commit 6dc35a3772

View File

@ -101,14 +101,14 @@ void msg_dialog_frame::Create(const std::string& msg, const std::string& title)
connect(m_button_yes, &QAbstractButton::clicked, [this]() connect(m_button_yes, &QAbstractButton::clicked, [this]()
{ {
g_last_user_response = CELL_MSGDIALOG_BUTTON_YES; g_last_user_response = CELL_MSGDIALOG_BUTTON_YES;
on_close(CELL_MSGDIALOG_BUTTON_YES); if (on_close) on_close(CELL_MSGDIALOG_BUTTON_YES);
m_dialog->accept(); m_dialog->accept();
}); });
connect(m_button_no, &QAbstractButton::clicked, [this]() connect(m_button_no, &QAbstractButton::clicked, [this]()
{ {
g_last_user_response = CELL_MSGDIALOG_BUTTON_NO; g_last_user_response = CELL_MSGDIALOG_BUTTON_NO;
on_close(CELL_MSGDIALOG_BUTTON_NO); if (on_close) on_close(CELL_MSGDIALOG_BUTTON_NO);
m_dialog->accept(); m_dialog->accept();
}); });
} }
@ -133,7 +133,7 @@ void msg_dialog_frame::Create(const std::string& msg, const std::string& title)
connect(m_button_ok, &QAbstractButton::clicked, [this]() connect(m_button_ok, &QAbstractButton::clicked, [this]()
{ {
g_last_user_response = CELL_MSGDIALOG_BUTTON_OK; g_last_user_response = CELL_MSGDIALOG_BUTTON_OK;
on_close(CELL_MSGDIALOG_BUTTON_OK); if (on_close) on_close(CELL_MSGDIALOG_BUTTON_OK);
m_dialog->accept(); m_dialog->accept();
}); });
} }
@ -145,7 +145,7 @@ void msg_dialog_frame::Create(const std::string& msg, const std::string& title)
if (!type.disable_cancel) if (!type.disable_cancel)
{ {
g_last_user_response = CELL_MSGDIALOG_BUTTON_ESCAPE; g_last_user_response = CELL_MSGDIALOG_BUTTON_ESCAPE;
on_close(CELL_MSGDIALOG_BUTTON_ESCAPE); if (on_close) on_close(CELL_MSGDIALOG_BUTTON_ESCAPE);
} }
}); });