fixed crash in cmd_set (use default trigger instead of NULL if no trigger is set)
authorpk910 <philipp@zoelle1.de>
Fri, 23 Dec 2011 21:51:24 +0000 (22:51 +0100)
committerpk910 <philipp@zoelle1.de>
Fri, 23 Dec 2011 21:53:25 +0000 (22:53 +0100)
src/cmd_neonserv_set.c

index 452da2e660e2ccf850ccc241e19192274a904841..b9d865ac93571f07be3d136f2c5131d1318a4af4 100644 (file)
@@ -319,10 +319,10 @@ static char* neonserv_cmd_set_trigger(struct ClientSocket *client, struct UserNo
     //get current trigger
     MYSQL_RES *res;
     MYSQL_ROW row;
-    printf_mysql_query("SELECT `trigger` FROM `bot_channels` WHERE `chanid` = '%d' AND `botid` = '%d'", chan->channel_id, client->clientid);
+    printf_mysql_query("SELECT `trigger`, `defaulttrigger` FROM `bot_channels` LEFT JOIN `bots` ON `botid` = `bots`.`id` WHERE `chanid` = '%d' AND `botid` = '%d'", chan->channel_id, client->clientid);
     res = mysql_use();
     row = mysql_fetch_row(res);
-    trigger = row[0];
+    trigger = (row[0] ? row[0] : row[1]);
     if(argument) {
         int uaccess = getChannelAccess(user, chan);
         if(uaccess < 500) {