From: Carlos Garcia Campos Date: Sun, 20 Jul 2008 11:27:20 +0000 (+0000) Subject: Make sure we always return a valid error struct when get_document_from_uri X-Git-Tag: EVINCE_2_23_5~5 X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=commitdiff_plain;h=85dfaace7e166d26bd304ea714df6fae9a21bdd6;p=evince.git Make sure we always return a valid error struct when get_document_from_uri 2008-07-20 Carlos Garcia Campos * 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 --- diff --git a/ChangeLog b/ChangeLog index 782e3dc1..6f6fa170 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-07-20 Carlos Garcia Campos + + * 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 * libdocument/ev-transition-effect.c diff --git a/libdocument/ev-document-factory.c b/libdocument/ev-document-factory.c index 64eaabaa..e7c76b90 100644 --- a/libdocument/ev-document-factory.c +++ b/libdocument/ev-document-factory.c @@ -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; }