From 7600f85a6982f0f66ba858d6370c6d81c1a16942 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Sat, 25 Jun 2022 01:21:25 +0300 Subject: [PATCH 48/48] Qt: Rework popup_messageopt_dialog() Resolve clang analyze warning about useless variable. See osdn #44937 Signed-off-by: Marko Lindqvist --- client/gui-qt/messagedlg.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/client/gui-qt/messagedlg.cpp b/client/gui-qt/messagedlg.cpp index 222846ed74..3a589e8a70 100644 --- a/client/gui-qt/messagedlg.cpp +++ b/client/gui-qt/messagedlg.cpp @@ -29,6 +29,7 @@ // gui-qt #include "fc_client.h" + #include "messagedlg.h" extern QApplication *qapp; @@ -175,20 +176,21 @@ void message_dlg::cancel_changes() **************************************************************************/ void popup_messageopt_dialog(void) { - message_dlg *mdlg; int i; QWidget *w; if (!gui()->is_repo_dlg_open("MSD")) { - mdlg = new message_dlg; + new message_dlg; } else { i = gui()->gimme_index_of("MSD"); + fc_assert(i != -1); + if (gui()->game_tab_widget->currentIndex() == i) { return; } + w = gui()->game_tab_widget->widget(i); - mdlg = reinterpret_cast(w); - gui()->game_tab_widget->setCurrentWidget(mdlg); + gui()->game_tab_widget->setCurrentWidget(w); } } -- 2.35.1