diff options
author | Robin Watts <robin.watts@artifex.com> | 2014-04-01 17:29:12 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2014-04-01 18:12:18 +0100 |
commit | 30daa4f77e2c1f07fbca59b37ff07b4b642a4ebc (patch) | |
tree | 424a602b6f347f20141b93826c1f2fc74c2f4fc6 | |
parent | 06832d88b710cbe26a626b4f7c699432e280b2d4 (diff) | |
download | mupdf-30daa4f77e2c1f07fbca59b37ff07b4b642a4ebc.tar.xz |
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.
-rw-r--r-- | platform/android/src/com/artifex/mupdfdemo/MuPDFActivity.java | 12 |
1 files changed, 7 insertions, 5 deletions
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) { |