summaryrefslogtreecommitdiff
path: root/src/commandhandler.cpp
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-03-27 06:45:13 -0600
committerJared Adams <jaxad0127@gmail.com>2009-03-27 06:45:13 -0600
commit268e47c0d3791483f3d0066e24c6686c3c938da9 (patch)
treefd22075a32c6d870acc5b78db25e9dddcbc7cd62 /src/commandhandler.cpp
parent8519fc5cb5d95e1ed753912aaa70a8f041c31abc (diff)
downloadmana-268e47c0d3791483f3d0066e24c6686c3c938da9.tar.gz
mana-268e47c0d3791483f3d0066e24c6686c3c938da9.tar.bz2
mana-268e47c0d3791483f3d0066e24c6686c3c938da9.tar.xz
mana-268e47c0d3791483f3d0066e24c6686c3c938da9.zip
Fix a segfault with empty whisper messages
Diffstat (limited to 'src/commandhandler.cpp')
-rw-r--r--src/commandhandler.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index f875fd85..b315b628 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -353,7 +353,8 @@ void CommandHandler::handleMsg(const std::string &args)
if (pos != std::string::npos)
{
recvnick = args.substr(1, pos - 1);
- msg = args.substr(pos + 2, args.length());
+ if (pos + 2 < args.length())
+ msg = args.substr(pos + 2, args.length());
}
}
else
@@ -362,7 +363,8 @@ void CommandHandler::handleMsg(const std::string &args)
if (pos != std::string::npos)
{
recvnick = args.substr(0, pos);
- msg = args.substr(pos + 1, args.length());
+ if (pos + 1 < args.length())
+ msg = args.substr(pos + 1, args.length());
}
else
{