From 32ad2dcec3a561acd2f4afc9478b1e8fbd426f41 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Wed, 11 Nov 2020 10:38:49 +0100 Subject: [PATCH] Android: Add null check for InputOverlay Hopefully fixes https://bugs.dolphin-emu.org/issues/12316. --- .../dolphinemu/fragments/EmulationFragment.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java index cfcd28ea02..61ff462536 100644 --- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java +++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/fragments/EmulationFragment.java @@ -94,14 +94,17 @@ public final class EmulationFragment extends Fragment implements SurfaceHolder.C doneButton.setOnClickListener(v -> stopConfiguringControls()); } - contents.post(() -> + if (mInputOverlay != null) { - int overlayX = mInputOverlay.getLeft(); - int overlayY = mInputOverlay.getTop(); - mInputOverlay.setSurfacePosition(new Rect( - surfaceView.getLeft() - overlayX, surfaceView.getTop() - overlayY, - surfaceView.getRight() - overlayX, surfaceView.getBottom() - overlayY)); - }); + contents.post(() -> + { + int overlayX = mInputOverlay.getLeft(); + int overlayY = mInputOverlay.getTop(); + mInputOverlay.setSurfacePosition(new Rect( + surfaceView.getLeft() - overlayX, surfaceView.getTop() - overlayY, + surfaceView.getRight() - overlayX, surfaceView.getBottom() - overlayY)); + }); + } // The new Surface created here will get passed to the native code via onSurfaceChanged.