diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-21 15:21:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-21 15:21:11 +0300 |
commit | cb9dd110965c4d0c4dbb671e769220f597d7278f (patch) | |
tree | c6490e8c1275687fd718ae4315b365401acb6a05 | |
parent | f3fcd24e8597feaabab67d0d354aef803958a465 (diff) | |
download | manaverse-cb9dd110965c4d0c4dbb671e769220f597d7278f.tar.gz manaverse-cb9dd110965c4d0c4dbb671e769220f597d7278f.tar.bz2 manaverse-cb9dd110965c4d0c4dbb671e769220f597d7278f.tar.xz manaverse-cb9dd110965c4d0c4dbb671e769220f597d7278f.zip |
Add some missing checks.
-rw-r--r-- | src/actionmanager.cpp | 14 |
1 files 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<int>(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; |