From 063c0c2a7369c62169facb313f78989d5dc99634 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Wed, 13 Mar 2019 09:39:30 +0100 Subject: [PATCH] Android: check SDL is initialized before sending the event Avoid error message: SDLActivity thread ends (error=Video subsystem has not been initialized) --- src/core/android/SDL_android.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/core/android/SDL_android.c b/src/core/android/SDL_android.c index cc7be09d2..fe365be38 100644 --- a/src/core/android/SDL_android.c +++ b/src/core/android/SDL_android.c @@ -741,7 +741,12 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeOrientationChanged)( SDL_LockMutex(Android_ActivityMutex); displayOrientation = (SDL_DisplayOrientation)orientation; - SDL_SendDisplayEvent(SDL_GetDisplay(0), SDL_DISPLAYEVENT_ORIENTATION, orientation); + + if (Android_Window) + { + SDL_VideoDisplay *display = SDL_GetDisplay(0); + SDL_SendDisplayEvent(display, SDL_DISPLAYEVENT_ORIENTATION, orientation); + } SDL_UnlockMutex(Android_ActivityMutex); }