summaryrefslogtreecommitdiff
path: root/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2013-03-21 16:50:52 +0000
committerRobin Watts <robin.watts@artifex.com>2013-03-21 17:00:31 +0000
commitc373cc8e44b0b32220088059ada161edfd0a2d78 (patch)
tree77f89488827327b4fe2a12329b0b39f7214cd161 /android/src/com/artifex/mupdfdemo/MuPDFActivity.java
parent6f1a3ce9dd2821042b146fb928c215b2d0549a3e (diff)
downloadmupdf-c373cc8e44b0b32220088059ada161edfd0a2d78.tar.xz
Bug 693719: Android: Catch exceptions when counting pages.
Return 0. Check for this case when opening a PDF and give a nice dialogue. Fix the nice dialogue code so that it doesn't crash afterwards due to a null mSearchTask.
Diffstat (limited to 'android/src/com/artifex/mupdfdemo/MuPDFActivity.java')
-rw-r--r--android/src/com/artifex/mupdfdemo/MuPDFActivity.java5
1 files changed, 4 insertions, 1 deletions
diff --git a/android/src/com/artifex/mupdfdemo/MuPDFActivity.java b/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
index 4f10e991..be8dca89 100644
--- a/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
+++ b/android/src/com/artifex/mupdfdemo/MuPDFActivity.java
@@ -312,6 +312,8 @@ public class MuPDFActivity extends Activity
core = openFile(Uri.decode(uri.getEncodedPath()));
}
SearchTaskResult.set(null);
+ if (core.countPages() == 0)
+ core = null;
}
if (core != null && core.needsPassword()) {
requestPassword(savedInstanceState);
@@ -743,7 +745,8 @@ public class MuPDFActivity extends Activity
protected void onPause() {
super.onPause();
- mSearchTask.stop();
+ if (mSearchTask != null)
+ mSearchTask.stop();
if (mFileName != null && mDocView != null) {
SharedPreferences prefs = getPreferences(Context.MODE_PRIVATE);