From 30daa4f77e2c1f07fbca59b37ff07b4b642a4ebc Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 1 Apr 2014 17:29:12 +0100 Subject: Solve crash (NullPointerException) when cancelling from password prompt Attempt to open a file that needs a password, and you will get a dialogue box. Hit cancel on this, and the program crashes. This is due to an attempt to release the bitmaps on a document view that does not exist. Simple fix. --- .../android/src/com/artifex/mupdfdemo/MuPDFActivity.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'platform/android/src/com') diff --git a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java index 2c74b6f8..db0bb3fb 100644 --- a/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java +++ b/platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java @@ -672,11 +672,13 @@ public class MuPDFActivity extends Activity implements FilePicker.FilePickerSupp public void onDestroy() { - mDocView.applyToChildren(new ReaderView.ViewMapper() { - void applyToView(View view) { - ((MuPDFView)view).releaseBitmaps(); - } - }); + if (mDocView != null) { + mDocView.applyToChildren(new ReaderView.ViewMapper() { + void applyToView(View view) { + ((MuPDFView)view).releaseBitmaps(); + } + }); + } if (core != null) core.onDestroy(); if (mAlertTask != null) { -- cgit v1.2.3