fixed crash in cmd_neonserv_mode.c
[NeonServV5.git] / src / modules / NeonServ.mod / cmd_neonserv_mode.c
index 789812974d4d2a481bf16ebb81924311cc5bbfa4..41e0455e11d50fe003358c867bc2b72e6a89e5f2 100644 (file)
@@ -1,4 +1,4 @@
-/* cmd_neonserv_mode.c - NeonServ v5.3
+/* cmd_neonserv_mode.c - NeonServ v5.6
  * Copyright (C) 2011-2012  Philipp Kreil (pk910)
  * 
  * This program is free software: you can redistribute it and/or modify
@@ -34,11 +34,11 @@ struct neonserv_cmd_mode_cache {
 CMD_BIND(neonserv_cmd_mode) {
     struct neonserv_cmd_mode_cache *cache = malloc(sizeof(*cache));
     if (!cache) {
-        perror("malloc() failed");
+        printf_log("neonserv", LOG_ERROR, "%s:%d malloc() failed", __FILE__, __LINE__);
         return;
     }
     cache->client = client;
-    cache->textclient = getTextBot();
+    cache->textclient = textclient;
     cache->user = user;
     cache->event = event;
     cache->mode = strdup(merge_argv(argv, 0, argc));
@@ -64,7 +64,7 @@ static void neonserv_cmd_mode_async1(struct ClientSocket *client, struct ClientS
     modeBuf = initModeBuffer(client, chan);
     printf_mysql_query("SELECT `channel_canop`, `channel_canvoice`, `channel_canban`, `channel_enfmodes`, `channel_modes` FROM `channels` WHERE `channel_id` = '%d'", chan->channel_id);
     row = mysql_fetch_row(mysql_use());
-    if(row[0] == NULL || row[1] == NULL || row[2] == NULL || row[3] == NULL) {
+    if(row[0] == NULL || row[1] == NULL || row[2] == NULL || row[3] == NULL || row[4] == NULL) {
         printf_mysql_query("SELECT `channel_canop`, `channel_canvoice`, `channel_canban`, `channel_enfmodes`, `channel_modes` FROM `channels` WHERE `channel_name` = 'defaults'");
         defaults = mysql_fetch_row(mysql_use());
     }