Skip to content

Commit 3bdc3a9

Browse files
giuliofgiomba
authored andcommitted
fix: check if a valid SDL2 event has been raised before accessing the event struct
1 parent b871422 commit 3bdc3a9

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/gui.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ static void gui_start(void) {
3333
static void gui_poll(void) {
3434
last_update = time_now_us();
3535

36-
SDL_PollEvent(&event);
36+
if (!SDL_PollEvent(&event))
37+
return;
38+
3739
quit = (event.type == SDL_QUIT);
3840

3941
// handle keyboard events

0 commit comments

Comments
 (0)