fixed several memory leaks
[NeonServV5.git] / src / bots.c
index d239dffaeced9ff4bc0dd4489825fe8b8b469829..c9b06164a0caf974d992324dd92fff1e69ff82e5 100644 (file)
@@ -1,5 +1,5 @@
 /* bots.c - NeonServ v5.3
- * Copyright (C) 2011  Philipp Kreil (pk910)
+ * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -87,7 +87,10 @@ static void zero_bots_trigger_callback(int clientid, struct ChanNode *chan, char
     }
     printf_mysql_query("SELECT `trigger`, `defaulttrigger` FROM `bot_channels` LEFT JOIN `bots` ON `botid` = `bots`.`id` WHERE `chanid` = '%d' AND `botclass` = '0' AND `botid` = '%d'", chan->channel_id, clientid);
     res = mysql_use();
-    row = mysql_fetch_row(res);
+    if(!(row = mysql_fetch_row(res))) {
+        strcpy(trigger, "");
+        return;
+    }
     if(row[0] && *row[0])
         strcpy(trigger, row[0]);
     else