From 7e2bd395bc1ffe986a3965dc2872e4c87e63ce58 Mon Sep 17 00:00:00 2001
From: Charles Lombardo <clombardo169@gmail.com>
Date: Thu, 14 Sep 2023 23:03:19 -0400
Subject: [PATCH] android: Return the correct status code on emulation stop

---
 src/android/app/src/main/jni/native.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/android/app/src/main/jni/native.cpp b/src/android/app/src/main/jni/native.cpp
index 8ac28b6386..8a2021ff06 100644
--- a/src/android/app/src/main/jni/native.cpp
+++ b/src/android/app/src/main/jni/native.cpp
@@ -327,12 +327,13 @@ public:
             m_system.ShutdownMainProcess();
             m_detached_tasks.WaitForAllTasks();
             m_load_result = Core::SystemResultStatus::ErrorNotInitialized;
+            m_window.reset();
+            OnEmulationStopped(Core::SystemResultStatus::Success);
+            return;
         }
 
         // Tear down the render window.
         m_window.reset();
-
-        OnEmulationStopped(m_load_result);
     }
 
     void PauseEmulation() {