Commit f6acbb2e authored by Moritz Lipp's avatar Moritz Lipp

Catch exception while opening document

Thanks to Sebastian Eiser
parent 48a8b98f
......@@ -33,10 +33,16 @@ pdf_document_open(zathura_document_t* document)
const char* path = zathura_document_get_path(document);
const char* password = zathura_document_get_password(document);
if (strstr(path, ".xps") != 0 || strstr(path, ".XPS") != 0 || strstr(path, ".rels") != 0) {
mupdf_document->document = (fz_document*) xps_open_document(mupdf_document->ctx, (char*) path);
} else {
mupdf_document->document = (fz_document*) pdf_open_document(mupdf_document->ctx, (char*) path);
fz_try(mupdf_document->ctx){
if (strstr(path, ".xps") != 0 || strstr(path, ".XPS") != 0 || strstr(path, ".rels") != 0) {
mupdf_document->document = (fz_document*) xps_open_document(mupdf_document->ctx, (char*) path);
} else {
mupdf_document->document = (fz_document*) pdf_open_document(mupdf_document->ctx, (char*) path);
}
}
fz_catch(mupdf_document->ctx){
error = ZATHURA_ERROR_UNKNOWN;
return error;
}
if (mupdf_document->document == NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment