]> jfr.im git - solanum.git/blobdiff - modules/core/m_join.c
Fix assertion failure when failing to join a channel and there is no forward.
[solanum.git] / modules / core / m_join.c
index c7c04b5b6342c5c2f5329589630ab557d5978ab9..7b8193a7d0b296a1165baf1ef0a7a0d4f5628c9e 100644 (file)
@@ -106,6 +106,8 @@ check_forward(struct Client *source_p, struct Channel *chptr,
 
        while (depth < 16)
        {
+               if (next == NULL)
+                       return NULL;
                chptr = find_channel(next);
                /* Can only forward to existing channels */
                if (chptr == NULL)
@@ -122,8 +124,6 @@ check_forward(struct Client *source_p, struct Channel *chptr,
                i = can_join(source_p, chptr, key, &next);
                if (i == 0)
                        return chptr;
-               if (next == NULL)
-                       return NULL;
                depth++;
        }