From f1c13d6ac84c6dd2948f2c2173d1a5e064780ed4 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sat, 24 Jun 2017 15:19:42 +0800 Subject: pdfapp: Handle PDF javascript not loading. --- platform/x11/pdfapp.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c index e5b7ed9e..14c83ef4 100644 --- a/platform/x11/pdfapp.c +++ b/platform/x11/pdfapp.c @@ -284,6 +284,7 @@ void pdfapp_open_progressive(pdfapp_t *app, char *filename, int reload, int bps) { fz_context *ctx = app->ctx; char *password = ""; + pdf_document *idoc; fz_try(ctx) { @@ -356,17 +357,22 @@ void pdfapp_open_progressive(pdfapp_t *app, char *filename, int reload, int bps) pdfapp_error(app, "cannot open document"); } - fz_try(ctx) + idoc = pdf_specifics(app->ctx, app->doc); + if (idoc) { - pdf_document *idoc; - - idoc = pdf_specifics(app->ctx, app->doc); - - if (idoc) + fz_try(ctx) { pdf_enable_js(ctx, idoc); pdf_set_doc_event_callback(ctx, idoc, event_cb, app); } + fz_catch(ctx) + { + pdfapp_error(app, "cannot load javascript embedded in document"); + } + } + + fz_try(ctx) + { if (fz_needs_password(app->ctx, app->doc)) { -- cgit v1.2.3