diff --git a/src/SFML/Window/Android/WindowImplAndroid.cpp b/src/SFML/Window/Android/WindowImplAndroid.cpp index 2d724eccd..9d595b03d 100644 --- a/src/SFML/Window/Android/WindowImplAndroid.cpp +++ b/src/SFML/Window/Android/WindowImplAndroid.cpp @@ -84,6 +84,7 @@ WindowImplAndroid::WindowImplAndroid(VideoMode mode, const String& title, unsign //////////////////////////////////////////////////////////// WindowImplAndroid::~WindowImplAndroid() { + WindowImplAndroid::singleInstance = NULL; } @@ -216,22 +217,25 @@ bool WindowImplAndroid::hasFocus() const //////////////////////////////////////////////////////////// void WindowImplAndroid::forwardEvent(const Event& event) { - ActivityStates* states = getActivity(NULL); - - if (event.type == Event::GainedFocus) + if (WindowImplAndroid::singleInstance != NULL) { - WindowImplAndroid::singleInstance->m_size.x = ANativeWindow_getWidth(states->window); - WindowImplAndroid::singleInstance->m_size.y = ANativeWindow_getHeight(states->window); - WindowImplAndroid::singleInstance->m_windowBeingCreated = true; - WindowImplAndroid::singleInstance->m_hasFocus = true; - } - else if (event.type == Event::LostFocus) - { - WindowImplAndroid::singleInstance->m_windowBeingDestroyed = true; - WindowImplAndroid::singleInstance->m_hasFocus = false; - } + ActivityStates* states = getActivity(NULL); - WindowImplAndroid::singleInstance->pushEvent(event); + if (event.type == Event::GainedFocus) + { + WindowImplAndroid::singleInstance->m_size.x = ANativeWindow_getWidth(states->window); + WindowImplAndroid::singleInstance->m_size.y = ANativeWindow_getHeight(states->window); + WindowImplAndroid::singleInstance->m_windowBeingCreated = true; + WindowImplAndroid::singleInstance->m_hasFocus = true; + } + else if (event.type == Event::LostFocus) + { + WindowImplAndroid::singleInstance->m_windowBeingDestroyed = true; + WindowImplAndroid::singleInstance->m_hasFocus = false; + } + + WindowImplAndroid::singleInstance->pushEvent(event); + } }