summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-12-21 15:21:11 +0300
committerAndrei Karas <akaras@inbox.ru>2012-12-21 15:21:11 +0300
commitcb9dd110965c4d0c4dbb671e769220f597d7278f (patch)
treec6490e8c1275687fd718ae4315b365401acb6a05 /src
parentf3fcd24e8597feaabab67d0d354aef803958a465 (diff)
downloadmv-cb9dd110965c4d0c4dbb671e769220f597d7278f.tar.gz
mv-cb9dd110965c4d0c4dbb671e769220f597d7278f.tar.bz2
mv-cb9dd110965c4d0c4dbb671e769220f597d7278f.tar.xz
mv-cb9dd110965c4d0c4dbb671e769220f597d7278f.zip
Add some missing checks.
Diffstat (limited to 'src')
-rw-r--r--src/actionmanager.cpp14
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;