From cb9dd110965c4d0c4dbb671e769220f597d7278f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 21 Dec 2012 15:21:11 +0300 Subject: Add some missing checks. --- src/actionmanager.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/actionmanager.cpp b/src/actionmanager.cpp index dd9239c12..f41a9269c 100644 --- a/src/actionmanager.cpp +++ b/src/actionmanager.cpp @@ -227,8 +227,11 @@ impHandler(shortcut) const int num = itemShortcutWindow->getTabIndex(); if (num >= 0 && num < static_cast(SHORTCUT_TABS)) { - itemShortcut[num]->useItem(event.action - - Input::KEY_SHORTCUT_1); + if (itemShortcut[num]) + { + itemShortcut[num]->useItem(event.action + - Input::KEY_SHORTCUT_1); + } } return true; } @@ -237,7 +240,7 @@ impHandler(shortcut) impHandler0(toggleChat) { - return chatWindow->requestChatFocus(); + return chatWindow ? chatWindow->requestChatFocus() : false; } impHandler0(prevChatTab) @@ -970,8 +973,9 @@ impHandler0(attack) { if (player_node) { - if (player_node->getTarget()) - player_node->attack(player_node->getTarget(), true); + Being *const target = player_node->getTarget(); + if (target) + player_node->attack(target, true); return true; } return false; -- cgit v1.2.3-70-g09d2