From 1d62cb0024b00a03079bdcd83cb1840eddd46882 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Mon, 20 Apr 2020 15:57:06 +0200 Subject: [PATCH] pdf renderer might throw security exception on password protected pdf --- .../java/eu/siacs/conversations/persistance/FileBackend.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java index 8958278eb..1ff94c7c0 100644 --- a/src/main/java/eu/siacs/conversations/persistance/FileBackend.java +++ b/src/main/java/eu/siacs/conversations/persistance/FileBackend.java @@ -943,7 +943,7 @@ public class FileBackend { final Bitmap rendered = renderPdfDocument(fileDescriptor, size, true); drawOverlay(rendered, paintOverlayBlackPdf(rendered) ? R.drawable.open_pdf_black : R.drawable.open_pdf_white, 0.75f); return rendered; - } catch (IOException e) { + } catch (final IOException | SecurityException e) { Log.d(Config.LOGTAG, "unable to render PDF document preview", e); final Bitmap placeholder = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); placeholder.eraseColor(0xff000000); @@ -1357,7 +1357,7 @@ public class FileBackend { page.close(); pdfRenderer.close(); return scalePdfDimensions(new Dimensions(height, width)); - } catch (IOException e) { + } catch (IOException | SecurityException e) { Log.d(Config.LOGTAG, "unable to get dimensions for pdf document", e); return new Dimensions(0, 0); }