From: pk910 Date: Wed, 28 Mar 2012 13:45:58 +0000 (+0200) Subject: fixed crash in cmd_recover X-Git-Tag: v5.4~23 X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=commitdiff_plain;h=2f821c1863d50646d3658a835c3675193b534f33 fixed crash in cmd_recover --- diff --git a/src/modules/NeonServ.mod/cmd_neonserv_recover.c b/src/modules/NeonServ.mod/cmd_neonserv_recover.c index 41ecda2..7e8999f 100644 --- a/src/modules/NeonServ.mod/cmd_neonserv_recover.c +++ b/src/modules/NeonServ.mod/cmd_neonserv_recover.c @@ -28,12 +28,6 @@ CMD_BIND(neonserv_cmd_recover) { reply(getTextBot(), user, "NS_INVALID_CHANNEL_NAME", argv[0]); return; } - printf_mysql_query("SELECT `botid`, `bot_channels`.`id` FROM `bot_channels` LEFT JOIN `bots` ON `bot_channels`.`botid` = `bots`.`id` WHERE `chanid` = '%d' AND `botclass` = '%d'", chan->channel_id, client->botid); - res = mysql_use(); - if ((row = mysql_fetch_row(res)) != NULL) { - reply(getTextBot(), user, "NS_REGISTER_ALREADY", argv[0], client->user->nick); - return; - } int chanid; printf_mysql_query("SELECT `channel_id` FROM `channels` WHERE `channel_name` = '%s'", escape_string(channel)); res = mysql_use(); @@ -43,6 +37,12 @@ CMD_BIND(neonserv_cmd_recover) { reply(getTextBot(), user, "NS_UNREGISTER_NOT_REGISTERED", argv[0], client->user->nick); return; } + printf_mysql_query("SELECT `botid`, `bot_channels`.`id` FROM `bot_channels` LEFT JOIN `bots` ON `bot_channels`.`botid` = `bots`.`id` WHERE `chanid` = '%d' AND `botclass` = '%d'", chanid, client->botid); + res = mysql_use(); + if ((row = mysql_fetch_row(res)) != NULL) { + reply(getTextBot(), user, "NS_REGISTER_ALREADY", argv[0], client->user->nick); + return; + } printf_mysql_query("SELECT `id`, `max_channels`, `defaulttrigger` FROM `bots` WHERE `botclass` = '%d' ORDER BY `register_priority` DESC", client->botid); res = mysql_use(); int botid = 0;