Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/backend
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2006-08-21 13:38:28 (GMT)
committer Carlos Garcia Campos <carlosgc@src.gnome.org>2006-08-21 13:38:28 (GMT)
commit2409a4e2aba8f8c83365492f44e8c3c801b852f8 (patch)
treeb8e5d213333e3cf768205df9a0dd6b3975163ced /backend
parent2ed9b1cb6b19debdaafdde18f901d9ef18269240 (diff)
Fix crash when opening a pdf with password protection.
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.
Diffstat (limited to 'backend')
-rw-r--r--backend/ev-document-factory.c37
1 files changed, 23 insertions, 14 deletions
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;
}