changeset 26912:ed5aec1cff44

Fix a NULL deref if the resource has gone offline by the time we're parsing this reply.
author Paul Aurich <paul@darkrain42.org>
date Tue, 19 May 2009 05:49:34 +0000
parents b18c6ab86e67
children 56460ebd1558
files libpurple/protocols/jabber/buddy.c
diffstat 1 files changed, 13 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c	Tue May 19 03:48:18 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Tue May 19 05:49:34 2009 +0000
@@ -1485,18 +1485,19 @@
                          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 == 
-                                    jabber_buddy_find_resource(jb, NULL)) {
-                                    purple_prpl_got_user_idle(js->gc->account, 
-                                        buddy_name, jbr->idle, jbr->idle);
+                            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);
+                                    }
                                 }
                             }
                         }