diff options
author | Carlos Garcia Campos <carlosgc@gnome.org> | 2008-07-20 11:27:20 (GMT) |
---|---|---|
committer | Carlos Garcia Campos <carlosgc@src.gnome.org> | 2008-07-20 11:27:20 (GMT) |
commit | 85dfaace7e166d26bd304ea714df6fae9a21bdd6 (patch) | |
tree | 0792a73e506fce59c2f87e397a3aefb3717d9be0 /libdocument/ev-document-factory.c | |
parent | 6afaaafedac6e693932f1b11df0e79516d107afd (diff) |
Make sure we always return a valid error struct when get_document_from_uri
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
Diffstat (limited to 'libdocument/ev-document-factory.c')
-rw-r--r-- | libdocument/ev-document-factory.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libdocument/ev-document-factory.c b/libdocument/ev-document-factory.c index 64eaaba..e7c76b9 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; } |