aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-04-05 21:18:42 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-04-05 21:18:42 +0300
commite74da72b824dfddacfb1c5386721d7094c0b7a94 (patch)
tree12f9e7429536de27b7bc04fa964d59d520aac866
parent24953ba9746427e908daee7ab5c0c30779d90aac (diff)
downloadminetest-e74da72b824dfddacfb1c5386721d7094c0b7a94.tar.gz
minetest-e74da72b824dfddacfb1c5386721d7094c0b7a94.tar.bz2
minetest-e74da72b824dfddacfb1c5386721d7094c0b7a94.zip
Fix crash when inputting only / in chat
-rw-r--r--src/servercommand.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/servercommand.cpp b/src/servercommand.cpp
index 2c74c81ea..cf89f7f56 100644
--- a/src/servercommand.cpp
+++ b/src/servercommand.cpp
@@ -160,11 +160,12 @@ void cmd_clearobjects(std::wostringstream &os,
std::wstring processServerCommand(ServerCommandContext *ctx)
{
-
std::wostringstream os(std::ios_base::binary);
ctx->flags = SEND_TO_SENDER; // Default, unless we change it.
- if(ctx->parms[0] == L"status")
+ if(ctx->parms.size() == 0)
+ os<<L"-!- Empty command";
+ else if(ctx->parms[0] == L"status")
cmd_status(os, ctx);
else if(ctx->parms[0] == L"time")
cmd_time(os, ctx);