fixed possibility crash
authorNurPech <nurpech@nurpech.de>
Wed, 10 Apr 2013 18:21:51 +0000 (20:21 +0200)
committerNurPech <nurpech@nurpech.de>
Wed, 10 Apr 2013 18:24:24 +0000 (20:24 +0200)
src/opserv.c

index b4aa0d9f6542641ab97176454fd074271922547c..d358d57637b4c59f10a51e819e99ee32115d2e6c 100644 (file)
@@ -4807,14 +4807,17 @@ static MODCMD_FUNC(cmd_simul)
 {
     struct userNode *target;
     char *line;
 {
     struct userNode *target;
     char *line;
-    if(!(target=GetUserH(argv[1]))) {
-        reply("OSMSG_SVSNONICK", argv[1]);
-        return 0;
+    if(argc > 2) {
+               if(!(target=GetUserH(argv[1]))) {
+                       reply("OSMSG_SVSNONICK", argv[1]);
+                       return 0;
+               }
+               line = unsplit_string(argv + 2, argc - 2, NULL);
+               irc_simul(target,line);
+               reply("OSMSG_SIMUL",target->nick,line);
+               return 1;
     }
     }
-    line = unsplit_string(argv + 2, argc - 2, NULL);
-    irc_simul(target,line);
-    reply("OSMSG_SIMUL",target->nick,line);
-    return 1;
+    return 0;
 }
 
 static MODCMD_FUNC(cmd_relay)
 }
 
 static MODCMD_FUNC(cmd_relay)