From 2ce9baa8adac8ceef59d92691436dd481d8a3423 Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 11 Oct 2020 14:51:14 +1000 Subject: [PATCH] Android: Fix possible crash in TouchscreenControllerView --- .../stenzek/duckstation/TouchscreenControllerView.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/android/app/src/main/java/com/github/stenzek/duckstation/TouchscreenControllerView.java b/android/app/src/main/java/com/github/stenzek/duckstation/TouchscreenControllerView.java index 9424ecc55..d601e13d3 100644 --- a/android/app/src/main/java/com/github/stenzek/duckstation/TouchscreenControllerView.java +++ b/android/app/src/main/java/com/github/stenzek/duckstation/TouchscreenControllerView.java @@ -44,9 +44,6 @@ public class TouchscreenControllerView extends FrameLayout { LayoutInflater inflater = LayoutInflater.from(getContext()); switch (viewType) { - case "none": - break; - case "digital": mMainView = inflater.inflate(R.layout.layout_touchscreen_controller_digital, this, true); break; @@ -59,11 +56,15 @@ public class TouchscreenControllerView extends FrameLayout { mMainView = inflater.inflate(R.layout.layout_touchscreen_controller_analog_sticks, this, true); break; + case "none": default: mMainView = null; break; } + if (mMainView == null) + return; + mMainView.setOnTouchListener((view1, event) -> { return handleTouchEvent(event); });