Check optional before it's used

This commit is contained in:
Patricia Aas 2021-06-22 10:27:33 +02:00 committed by Patricia Aas
parent 4e753a6024
commit 1fb5f23885
1 changed files with 1 additions and 1 deletions

View File

@ -34,7 +34,7 @@ void Game::eatPellets() {
void Game::processEvents(InputState & inputState) {
auto event = canvas.pollEvent();
if (event->type == sf::Event::Closed) {
if (event && event->type == sf::Event::Closed) {
inputState.close = true;
return;
}