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

View file

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