]> jfr.im git - irc/quakenet/newserv.git/commitdiff
a4stats: Fix a crash in a4stats_update_user_cb.
authorGunnar Beutner <redacted>
Wed, 26 Feb 2014 18:43:59 +0000 (19:43 +0100)
committerGunnar Beutner <redacted>
Wed, 26 Feb 2014 18:43:59 +0000 (19:43 +0100)
a4stats/a4stats_db.c

index fb9e725f2fd20d6de1a33a77810c25d92bd54c86..ea447a657aeea99e644f314b9e92bfa03d8a4e41 100644 (file)
@@ -196,11 +196,11 @@ static void a4stats_update_user_cb(const struct DBAPIResult *result, void *uarg)
 
   uui->stage++;
 
-  if (uui->stage == 1 || uui->stage == 3)
+  if (uui->stage == 1 || (result != NULL && uui->stage == 3))
     a4statsdb->query(a4statsdb, a4stats_update_user_cb, uui, uui->update, "TUUs", "users", uui->channelid, uui->accountid, uui->account);
   else {
-    if (result->affected > 0 || uui->stage == 4) {
-      if (result->affected == 0 && uui->stage == 4)
+    if (result == NULL || result->affected > 0 || uui->stage == 4) {
+      if (result == NULL || result->affected == 0 && uui->stage == 4)
         Error("a4stats", ERR_WARNING, "Unable to update user.");
 
       free(uui->update);