Make sure the window still exists before we access the dimensions on it

This commit is contained in:
Tiaan Louw 2015-03-31 21:42:04 +02:00 committed by Lukas Dürrenberger
parent 608b4fb28d
commit 46a625dde5

View File

@ -386,6 +386,8 @@ static void onContentRectChanged(ANativeActivity* activity, const ARect* rect)
sf::priv::ActivityStates* states = sf::priv::retrieveStates(activity); sf::priv::ActivityStates* states = sf::priv::retrieveStates(activity);
sf::Lock lock(states->mutex); sf::Lock lock(states->mutex);
// Make sure the window still exists before we access the dimensions on it
if (states->window != NULL) {
// Send an event to warn people about the window move/resize // Send an event to warn people about the window move/resize
sf::Event event; sf::Event event;
event.type = sf::Event::Resized; event.type = sf::Event::Resized;
@ -393,6 +395,7 @@ static void onContentRectChanged(ANativeActivity* activity, const ARect* rect)
event.size.height = ANativeWindow_getHeight(states->window); event.size.height = ANativeWindow_getHeight(states->window);
states->forwardEvent(event); states->forwardEvent(event);
}
} }