Handle document being null when going to page.
diff --git a/lib/src/main/java/com/artifex/mupdf/viewer/MuPDFCore.java b/lib/src/main/java/com/artifex/mupdf/viewer/MuPDFCore.java
index 387eee1..e572ecc 100644
--- a/lib/src/main/java/com/artifex/mupdf/viewer/MuPDFCore.java
+++ b/lib/src/main/java/com/artifex/mupdf/viewer/MuPDFCore.java
@@ -99,10 +99,16 @@
if (displayList != null)
displayList.destroy();
displayList = null;
- page = doc.loadPage(pageNum);
- Rect b = page.getBounds();
- pageWidth = b.x1 - b.x0;
- pageHeight = b.y1 - b.y0;
+ if (doc != null) {
+ page = doc.loadPage(pageNum);
+ Rect b = page.getBounds();
+ pageWidth = b.x1 - b.x0;
+ pageHeight = b.y1 - b.y0;
+ } else {
+ page = null;
+ pageWidth = 0;
+ pageHeight = 0;
+ }
}
}