pidgin: 0441282c: Fix a NULL deref if the resource has gon...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Tue May 19 02:00:56 EDT 2009


-----------------------------------------------------------------
Revision: 0441282c49ee120808df92f16d30a61e92029474
Ancestor: 56d9a727daf3df8e3daedd930baa64480b3c279c
Author: darkrain42 at pidgin.im
Date: 2009-05-19T05:49:34
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/0441282c49ee120808df92f16d30a61e92029474

Modified files:
        libpurple/protocols/jabber/buddy.c

ChangeLog: 

Fix a NULL deref if the resource has gone offline by the time we're parsing this reply.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c	3ba51c7b8e6d13e0c4d2bb6180eab4cc0b137552
+++ libpurple/protocols/jabber/buddy.c	08dfe111730e3e2fad645425636008fa86ce7976
@@ -1485,19 +1485,20 @@ static void jabber_last_parse(JabberStre
                          the resource getting unidle */
                         if (resource && buddy_name) {
                             jbr = jabber_buddy_find_resource(jb, resource);
-                            
-                            if (jbr->idle) {
-                                if (sec) {
-                                    jbr->idle = time(NULL) - sec;
-                                } else {
-                                    jbr->idle = 0;
+                            if (jbr) {
+                                if (jbr->idle) {
+                                    if (sec) {
+                                        jbr->idle = time(NULL) - sec;
+                                    } else {
+                                        jbr->idle = 0;
+                                    }
+
+                                    if (jbr == 
+                                        jabber_buddy_find_resource(jb, NULL)) {
+                                        purple_prpl_got_user_idle(js->gc->account, 
+                                            buddy_name, jbr->idle, jbr->idle);
+                                    }
                                 }
-                            
-                                if (jbr == 
-                                    jabber_buddy_find_resource(jb, NULL)) {
-                                    purple_prpl_got_user_idle(js->gc->account, 
-                                        buddy_name, jbr->idle, jbr->idle);
-                                }
                             }
                         }
                         g_free(resource);


More information about the Commits mailing list