]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc.c
Get rid of unclever assert() in Send_Message_Mask()
[ngircd-alex.git] / src / ngircd / irc.c
index cfe616f5f33ac9845c9cfbdf92392f183bfdc9a8..e990cfd7a0397d2f6e42c9e42dc7d4d10db2a8af 100644 (file)
@@ -339,9 +339,12 @@ GLOBAL bool
 IRC_KillClient(CLIENT *Client, CLIENT *From, const char *Nick, const char *Reason)
 {
        const char *msg;
-       CONN_ID my_conn, conn;
+       CONN_ID my_conn = NONE, conn;
        CLIENT *c;
 
+       assert(Nick != NULL);
+       assert(Reason != NULL);
+
        /* Do we know such a client in the network? */
        c = Client_Search(Nick);
        if (!c) {
@@ -376,7 +379,8 @@ IRC_KillClient(CLIENT *Client, CLIENT *From, const char *Nick, const char *Reaso
        }
 
        /* Save ID of this connection */
-       my_conn = Client_Conn(Client);
+       if (Client)
+               my_conn = Client_Conn(Client);
 
        /* Kill the client NOW:
         *  - Close the local connection (if there is one),
@@ -740,10 +744,7 @@ Send_Message_Mask(CLIENT * from, char * command, char * targetMask,
         * dot (".") and no wildcards ("*", "?") following the last one.
         */
        check_wildcards = strrchr(targetMask, '.');
-       assert(check_wildcards != NULL);
-       if (check_wildcards &&
-               check_wildcards[strcspn(check_wildcards, "*?")])
-       {
+       if (!check_wildcards || check_wildcards[strcspn(check_wildcards, "*?")]) {
                if (!SendErrors)
                        return true;
                return IRC_WriteErrClient(from, ERR_WILDTOPLEVEL, targetMask);