about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorMichael Santos <michael.santos@gmail.com>2017-04-12 10:20:22 -0400
committerMichael Santos <michael.santos@gmail.com>2017-04-12 10:20:22 -0400
commitdb18ba8bdf7d0c6d60357b8ab21129c332316a17 (patch)
tree3a01b9d1534e4848ae168d26a6033cfbe41ad605 /src
parent2fafaec8a7dc9bc01ee894d83214590598b32914 (diff)
downloadprofani-tty-db18ba8bdf7d0c6d60357b8ab21129c332316a17.tar.gz
server_events: fix potential NULL pointer deref
Diffstat (limited to 'src')
-rw-r--r--src/event/server_events.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/event/server_events.c b/src/event/server_events.c
index f0b2e176..57a681cc 100644
--- a/src/event/server_events.c
+++ b/src/event/server_events.c
@@ -889,8 +889,8 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
         ProfMucWin *mucwin = wins_get_muc(room);
         if (mucwin) {
             mucwin_occupant_nick_change(mucwin, old_nick, nick);
+            wins_private_nick_change(mucwin->roomjid, old_nick, nick);
         }
-        wins_private_nick_change(mucwin->roomjid, old_nick, nick);
         free(old_nick);
 
         occupantswin_occupants(room);
@@ -907,11 +907,13 @@ sv_ev_muc_occupant_online(const char *const room, const char *const nick, const
         }
         prefs_free_string(muc_status_pref);
 
-        Jid *jidp = jid_create_from_bare_and_resource(mucwin->roomjid, nick);
-        ProfPrivateWin *privwin = wins_get_private(jidp->fulljid);
-        jid_destroy(jidp);
-        if (privwin) {
-            privwin_occupant_online(privwin);
+        if (mucwin) {
+            Jid *jidp = jid_create_from_bare_and_resource(mucwin->roomjid, nick);
+            ProfPrivateWin *privwin = wins_get_private(jidp->fulljid);
+            jid_destroy(jidp);
+            if (privwin) {
+                privwin_occupant_online(privwin);
+            }
         }
 
         occupantswin_occupants(room);