File: fix-crashes-at-startup.patch

package info (click to toggle)
moon-lander 1%3A1.0-9
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 2,340 kB
  • sloc: ansic: 1,732; makefile: 31; sh: 19
file content (19 lines) | stat: -rw-r--r-- 563 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
From: Artur Rona <ari-tczew@ubuntu.com>
Description: Test that SDL_PollEvent(&event) returns 1 before using event (application closing at startup).
Author: Adrien Cunin <adri2000@ubuntu.com>
Bug-Ubuntu: https://launchpad.net/bugs/193756
Last-Update: 2016-01-02

--- moon-lander-1.0.orig/moon_lander.c
+++ moon-lander-1.0/moon_lander.c
@@ -1446,9 +1446,7 @@ void gameloop(Game *game){
 
       /* read keyboard */
 
-    SDL_PollEvent(&event);
-
-    if (event.type == SDL_QUIT){
+    if (SDL_PollEvent(&event) && event.type == SDL_QUIT){
       exit(0);
     }