Protect against a possibly NULL exception.
authorJeffrey Stedfast <fejj@ximian.com>
Mon, 19 Mar 2001 02:21:44 +0000 (02:21 +0000)
committerJeffrey Stedfast <fejj@src.gnome.org>
Mon, 19 Mar 2001 02:21:44 +0000 (02:21 +0000)
2001-03-18  Jeffrey Stedfast  <fejj@ximian.com>

* camel-remote-store.c (remote_recv_line): Protect against a
possibly NULL exception.

camel/ChangeLog
camel/camel-remote-store.c

index b42c5ba..e5c564e 100644 (file)
@@ -1,5 +1,8 @@
 2001-03-18  Jeffrey Stedfast  <fejj@ximian.com>
 
+       * camel-remote-store.c (remote_recv_line): Protect against a
+       possibly NULL exception.
+
        * camel-filter-driver.c (camel_filter_driver_filter_message):
        Document and modify to return a boolean value denoting whether or
        not errors occured during processing.
index ef06eb7..856bcf1 100644 (file)
@@ -419,6 +419,7 @@ remote_recv_line (CamelRemoteStore *store, char **dest, CamelException *ex)
        CamelStreamBuffer *stream;
        GByteArray *bytes;
        gchar buf[1024], *ret;
+       gboolean exception = FALSE;
        gint nread;
        
        *dest = NULL;
@@ -444,15 +445,17 @@ remote_recv_line (CamelRemoteStore *store, char **dest, CamelException *ex)
        } while (nread == sizeof (buf) - 1);
 
        if (nread == -1) {
+               exception = TRUE;
                if (errno == EINTR)
                        camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled"));
                else
                        camel_exception_set(ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, strerror(errno));
        } else if (bytes->len == 0) {
+               exception = TRUE;
                camel_exception_set(ex, CAMEL_EXCEPTION_SERVICE_NOT_CONNECTED,
                                    _("Server unexpectedly disconnected"));
        }
-       if (camel_exception_is_set (ex)) {
+       if (camel_exception_is_set (ex) || exception) {
                g_byte_array_free(bytes, TRUE);
                camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
                return -1;