]> www.fi.muni.cz Git - evince.git/commitdiff
Make sure we always return a valid error struct when get_document_from_uri
authorCarlos Garcia Campos <carlosgc@gnome.org>
Sun, 20 Jul 2008 11:27:20 +0000 (11:27 +0000)
committerCarlos Garcia Campos <carlosgc@src.gnome.org>
Sun, 20 Jul 2008 11:27:20 +0000 (11:27 +0000)
2008-07-20  Carlos Garcia Campos  <carlosgc@gnome.org>

* libdocument/ev-document-factory.c: (get_mime_type_from_data),
(get_document_from_uri):

Make sure we always return a valid error struct when
get_document_from_uri fails. Fixes nautilus crash, see bug
#542548.

svn path=/trunk/; revision=3076

ChangeLog
libdocument/ev-document-factory.c

index 782e3dc175cf0ee71e8e757d8429017123bd2332..6f6fa17080e481b2aa10401d214061850a1e514f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-07-20  Carlos Garcia Campos  <carlosgc@gnome.org>
+
+       * libdocument/ev-document-factory.c: (get_mime_type_from_data),
+       (get_document_from_uri):
+
+       Make sure we always return a valid error struct when
+       get_document_from_uri fails. Fixes nautilus crash, see bug
+       #542548.
+       
 2008-07-15   Darren Kenny  <darren.kenny@sun.com>
 
        * libdocument/ev-transition-effect.c
index 64eaabaa25d52ac37487db5cf3367ab05c6dbca9..e7c76b905f8ae1472643746d43e2c3225527c250 100644 (file)
@@ -143,7 +143,7 @@ get_mime_type_from_data (const gchar *uri, GError **error)
 
        size_read = g_input_stream_read (G_INPUT_STREAM (input_stream),
                                         buffer, 1024, NULL, NULL);
-       g_input_stream_close (G_INPUT_STREAM (input_stream), NULL, NULL);
+       g_input_stream_close (G_INPUT_STREAM (input_stream), NULL, error);
 
        g_object_unref (file);
 
@@ -172,6 +172,13 @@ get_document_from_uri (const char        *uri,
 
        if (mime_type == NULL) {
                g_free (mime_type);
+
+               if (*error == NULL) {
+                       g_set_error (error,
+                                    EV_DOCUMENT_ERROR,
+                                    0,
+                                    _("Unknown MIME Type"));
+               }
                
                return NULL;
        }