From fea0f8467f983cc5c1075d19787a4b398d0d5e22 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 8 Jun 2016 11:47:07 +0100 Subject: Bug 696826: Android Viewer: Cope with null item It seems that we can end up with a null item in MuPDFReaderView onSingleTap. Add some simple checks to avoid this. --- .../android/viewer/src/com/artifex/mupdfdemo/MuPDFReaderView.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'platform') diff --git a/platform/android/viewer/src/com/artifex/mupdfdemo/MuPDFReaderView.java b/platform/android/viewer/src/com/artifex/mupdfdemo/MuPDFReaderView.java index f2d7f8fe..b712cba9 100644 --- a/platform/android/viewer/src/com/artifex/mupdfdemo/MuPDFReaderView.java +++ b/platform/android/viewer/src/com/artifex/mupdfdemo/MuPDFReaderView.java @@ -69,8 +69,9 @@ public class MuPDFReaderView extends ReaderView { if (mMode == Mode.Viewing && !tapDisabled) { MuPDFView pageView = (MuPDFView) getDisplayedView(); - Hit item = pageView.passClickEvent(e.getX(), e.getY()); - onHit(item); + Hit item = pageView != null ? pageView.passClickEvent(e.getX(), e.getY()) : null; + if (item != null) + onHit(item); if (item == Hit.Nothing) { if (mLinksEnabled && pageView != null && (link = pageView.hitLink(e.getX(), e.getY())) != null) { -- cgit v1.2.3