From 4fbb944f132eb886a6f5b350e5a14a4fe380aacf Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 11 Jul 2015 00:12:09 +0300 Subject: Add missing checks into gui. --- src/gui/windows/chatwindow.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/gui/windows/chatwindow.cpp') diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 3f26cc4dc..f7a101a44 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -692,11 +692,11 @@ void ChatWindow::mousePressed(MouseEvent &event) { if (popupMenu) { - Tab *const tab = mChatTabs->getSelectedTab(); - if (tab) + ChatTab *const cTab = dynamic_cast( + mChatTabs->getSelectedTab()); + if (cTab) { event.consume(); - ChatTab *const cTab = dynamic_cast(tab); if (inputManager.isActionActive(InputAction::CHAT_MOD)) { inputManager.executeChatCommand( @@ -2163,11 +2163,14 @@ void ChatWindow::showGMTab() void ChatWindow::joinRoom(const bool isJoin) { Tab *const tab = mChatTabs->getTabByIndex(0); - std::string name; - if (isJoin) - name = PlayerInfo::getRoomName(); - else - name = _("General"); - tab->setCaption(name); + if (tab) + { + std::string name; + if (isJoin) + name = PlayerInfo::getRoomName(); + else + name = _("General"); + tab->setCaption(name); + } } #endif -- cgit v1.2.3-70-g09d2