From 14d0bb534e21b84ddaf619ae0b6672d72830e481 Mon Sep 17 00:00:00 2001 From: kleidis <167202775+kleidis@users.noreply.github.com> Date: Wed, 21 Aug 2024 14:39:44 +0200 Subject: [PATCH] Fix pause emulator button crashing the emulator --- 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 a421119de..edbf7fe44 100644 --- a/src/android/app/src/main/jni/native.cpp +++ b/src/android/app/src/main/jni/native.cpp @@ -316,10 +316,12 @@ void Java_io_github_lime3ds_android_NativeLibrary_surfaceChanged(JNIEnv* env, void Java_io_github_lime3ds_android_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); + } } }