summaryrefslogtreecommitdiff
path: root/src/actions/commands.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-18 16:16:06 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-18 16:16:06 +0300
commit3632ab0a66bd3a14c8848982b15bfa30715dded7 (patch)
tree4d6864e1386f17799be24a8302214724f807f423 /src/actions/commands.cpp
parenta80f8f578a78752b5b43f3aeb8759b0db4c51714 (diff)
downloadmanaplus-3632ab0a66bd3a14c8848982b15bfa30715dded7.tar.gz
manaplus-3632ab0a66bd3a14c8848982b15bfa30715dded7.tar.bz2
manaplus-3632ab0a66bd3a14c8848982b15bfa30715dded7.tar.xz
manaplus-3632ab0a66bd3a14c8848982b15bfa30715dded7.zip
Improve a bit performance in commands.cpp
Diffstat (limited to 'src/actions/commands.cpp')
-rw-r--r--src/actions/commands.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index fa4ea6767..a91e6f244 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -90,8 +90,11 @@ static std::string getNick(const InputEvent &event)
std::string args = event.args;
if (args.empty())
{
- WhisperTab *const whisper = dynamic_cast<WhisperTab* const>(event.tab);
- if (!whisper || whisper->getNick().empty())
+ if (!event.tab || event.tab->getType() != ChatTabType::WHISPER)
+ return std::string();
+
+ WhisperTab *const whisper = static_cast<WhisperTab* const>(event.tab);
+ if (whisper->getNick().empty())
{
if (event.tab)
{