From 9c1f778e797ed03dd07b5b554748900a433efe89 Mon Sep 17 00:00:00 2001 From: kleidis <167202775+kleidis@users.noreply.github.com> Date: Thu, 22 Aug 2024 23:33:05 +0200 Subject: [PATCH] android: Fix pause emulator button crashing the emulator (#239) --- src/android/app/src/main/jni/native.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp index 393ce906d..2df3465aa 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -309,10 +309,12 @@ void Java_org_citra_citra_1emu_NativeLibrary_surfaceChanged(JNIEnv* env, void Java_org_citra_citra_1emu_NativeLibrary_surfaceDestroyed([[maybe_unused]] JNIEnv* env, [[maybe_unused]] jobject obj) { - ANativeWindow_release(s_surf); - s_surf = nullptr; - if (window) { - window->OnSurfaceChanged(s_surf); + if (s_surf != nullptr) { + ANativeWindow_release(s_surf); + s_surf = nullptr; + if (window) { + window->OnSurfaceChanged(s_surf); + } } }