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 /src | |
parent | f3fcd24e8597feaabab67d0d354aef803958a465 (diff) | |
download | manaplus-cb9dd110965c4d0c4dbb671e769220f597d7278f.tar.gz manaplus-cb9dd110965c4d0c4dbb671e769220f597d7278f.tar.bz2 manaplus-cb9dd110965c4d0c4dbb671e769220f597d7278f.tar.xz manaplus-cb9dd110965c4d0c4dbb671e769220f597d7278f.zip |
Add some missing checks.
Diffstat (limited to 'src')
-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; |