Check ic->status is not NULL imapx_command_select_done ()
authorRaul Gutierrez Segales <rgs@collabora.co.uk>
Fri, 26 Aug 2011 09:36:02 +0000 (10:36 +0100)
committerRaul Gutierrez Segales <rgs@collabora.co.uk>
Fri, 26 Aug 2011 13:57:47 +0000 (14:57 +0100)
There are ocassions (are they even valid?) in which ic->status
might be NULL, so we check for that before trying to access
ic->status->text when calling g_set_error ().

Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=639717

camel/providers/imapx/camel-imapx-server.c

index 35a7f15..4a859d8 100644 (file)
@@ -2582,12 +2582,16 @@ imapx_command_select_done (CamelIMAPXServer *is, CamelIMAPXCommand *ic)
                                if (ic->error != NULL) {
                                        g_propagate_error (&cw->error, ic->error);
                                        ic->error = NULL;
-                               } else
+                               } else {
+                                       if (ic->status == NULL)
+                                               /* FIXME: why is ic->status == NULL here? It shouldn't happen. */
+                                               g_debug ("imapx_command_select_done: ic->status is NULL.");
                                        g_set_error (
                                                &cw->error, CAMEL_IMAPX_ERROR, 1,
                                                "SELECT %s failed: %s",
                                                camel_folder_get_full_name (cw->select),
-                                               ic->status->text? ic->status->text:"<unknown reason>");
+                                               ic->status && ic->status->text? ic->status->text:"<unknown reason>");
+                               }
                                cw->complete (is, cw);
                                cw = cn;
                                cn = cn->next;