Fix #222: SIPE crashes when groupchat session expires (V)
authorStefan Becker <chemobejk@gmail.com>
Wed, 4 Dec 2013 06:50:07 +0000 (4 08:50 +0200)
committerStefan Becker <chemobejk@gmail.com>
Thu, 5 Dec 2013 20:48:42 +0000 (5 22:48 +0200)
Another user still sees crashes. I don't have the full debug log, so I
can only guess that re-initialization of the groupchat session has
failed.

Add more sanity checks to groupchat_update_cb().

(cherry picked from commit daa3609c31fdcd2ded14bcab4044cfa23842f743)

src/core/sipe-groupchat.c

index f90909e..20e50a6 100644 (file)
@@ -383,19 +383,23 @@ static void groupchat_update_cb(struct sipe_core_private *sipe_private,
                                SIPE_UNUSED_PARAMETER gpointer data)
 {
        struct sipe_groupchat *groupchat = sipe_private->groupchat;
-       struct sip_dialog *dialog = sipe_dialog_find(groupchat->session,
-                                                    groupchat->session->with);
 
-       if (dialog)
-               sip_transport_update(sipe_private,
-                                    dialog,
-                                    groupchat_expired_session_response);
-       sipe_schedule_seconds(sipe_private,
-                             "<+groupchat-expires>",
-                             NULL,
-                             groupchat->expires,
-                             groupchat_update_cb,
-                             NULL);
+       if (groupchat->session) {
+               struct sip_dialog *dialog = sipe_dialog_find(groupchat->session,
+                                                            groupchat->session->with);
+
+               if (dialog) {
+                       sip_transport_update(sipe_private,
+                                            dialog,
+                                            groupchat_expired_session_response);
+                       sipe_schedule_seconds(sipe_private,
+                                             "<+groupchat-expires>",
+                                             NULL,
+                                             groupchat->expires,
+                                             groupchat_update_cb,
+                                             NULL);
+               }
+       }
 }
 
 static struct sipe_groupchat_msg *chatserver_command(struct sipe_core_private *sipe_private,