Fix common app issue where the users clicks before the UI was created.
diff --git a/lib/src/main/java/com/artifex/mupdf/viewer/DocumentActivity.java b/lib/src/main/java/com/artifex/mupdf/viewer/DocumentActivity.java
index 708b74c..01af79e 100644
--- a/lib/src/main/java/com/artifex/mupdf/viewer/DocumentActivity.java
+++ b/lib/src/main/java/com/artifex/mupdf/viewer/DocumentActivity.java
@@ -810,7 +810,7 @@
@Override
public void onBackPressed() {
- if (!mDocView.popHistory()) {
+ if (mDocView == null || !mDocView.popHistory()) {
super.onBackPressed();
Intent intent = getPackageManager().getLaunchIntentForPackage(getComponentName().getPackageName());
startActivity(intent);