diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | backend/ev-document-factory.c | 37 |
2 files changed, 29 insertions, 14 deletions
@@ -1,3 +1,9 @@ +2006-08-21 Carlos Garcia Campos <carlosgc@gnome.org> + + * backend/ev-document-factory.c: (ev_document_factory_get_document): + + Fix crash when opening a pdf with password protection. + 2006-08-19 Carlos Garcia Campos <carlosgc@gnome.org> * pdf/ev-poppler.cc: (pdf_document_search_free): diff --git a/backend/ev-document-factory.c b/backend/ev-document-factory.c index 278a21a..3b3f701 100644 --- a/backend/ev-document-factory.c +++ b/backend/ev-document-factory.c @@ -296,15 +296,21 @@ ev_document_factory_get_document (const char *uri, GError **error) } result = ev_document_load (document, uri, error); - + if (result == FALSE || *error) { - if (document) - g_object_unref (document); - document = NULL; + if (*error && + (*error)->domain == EV_DOCUMENT_ERROR && + (*error)->code == EV_DOCUMENT_ERROR_ENCRYPTED) + return document; } else { return document; } + /* Try again with slow mime detection */ + if (document) + g_object_unref (document); + document = NULL; + if (*error) g_error_free (*error); *error = NULL; @@ -316,20 +322,23 @@ ev_document_factory_get_document (const char *uri, GError **error) } result = ev_document_load (document, uri, error); - - if (result == FALSE || *error) { + + if (result == FALSE) { + if (*error == NULL) { + g_set_error (error, + EV_DOCUMENT_ERROR, + 0, + _("Unknown MIME Type")); + } else if ((*error)->domain == EV_DOCUMENT_ERROR && + (*error)->code == EV_DOCUMENT_ERROR_ENCRYPTED) { + return document; + } + if (document) g_object_unref (document); document = NULL; } - - if (result == FALSE && *error == NULL) { - g_set_error (error, - EV_DOCUMENT_ERROR, - 0, - _("Unknown MIME Type")); - } - + return document; } |