From 08ee66582f53822254763d79ca511c24b136be0f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 20 Jul 2015 14:40:19 +0300 Subject: Add some missing checks. --- src/gui/gui.cpp | 8 ++++++-- src/gui/models/playertablemodel.cpp | 4 ---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index c4c69afa1..382cd42bf 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -909,7 +909,7 @@ void Gui::distributeMouseEvent(Widget *const source, if (type == MouseEventType::RELEASED) dragDrop.clear(); - if (event.isConsumed()) + if (!widget || event.isConsumed()) break; // If a non modal focused widget has been reach @@ -1306,8 +1306,12 @@ void Gui::distributeKeyEvent(KeyEvent &event) const // If a non modal focused widget has been reach // and we have modal focus cancel the distribution. - if (mFocusHandler->getModalFocused() && !widget->isModalFocused()) + if (widget && + mFocusHandler->getModalFocused() && + !widget->isModalFocused()) + { break; + } } } diff --git a/src/gui/models/playertablemodel.cpp b/src/gui/models/playertablemodel.cpp index 8844404a9..b846e7b91 100644 --- a/src/gui/models/playertablemodel.cpp +++ b/src/gui/models/playertablemodel.cpp @@ -96,10 +96,6 @@ void PlayerTableModel::playerRelationsUpdated() freeWidgets(); StringVect *const player_names = player_relations.getPlayers(); - - if (!player_names) - return; - delete mPlayers; mPlayers = player_names; -- cgit v1.2.3-70-g09d2