Skip to content

Commit

Permalink
Make sure the window still exists before we access the dimensions on it
Browse files Browse the repository at this point in the history
  • Loading branch information
tiaanl authored and eXpl0it3r committed May 20, 2015
1 parent 608b4fb commit 46a625d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/SFML/Main/MainAndroid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,13 +386,16 @@ static void onContentRectChanged(ANativeActivity* activity, const ARect* rect)
sf::priv::ActivityStates* states = sf::priv::retrieveStates(activity);
sf::Lock lock(states->mutex);

// Send an event to warn people about the window move/resize
sf::Event event;
event.type = sf::Event::Resized;
event.size.width = ANativeWindow_getWidth(states->window);
event.size.height = ANativeWindow_getHeight(states->window);

states->forwardEvent(event);
// 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
sf::Event event;
event.type = sf::Event::Resized;
event.size.width = ANativeWindow_getWidth(states->window);
event.size.height = ANativeWindow_getHeight(states->window);

states->forwardEvent(event);
}
}


Expand Down

0 comments on commit 46a625d

Please sign in to comment.