Package: heroes / 0.21-18

sdl-joystick-api.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Description: Avoid SDL's joystick API if it's uninitialised
Author: Alexandre Duret-Lutz <[email protected]>
Bug-Debian: https://bugs.debian.org/169525
Last-Update: 2016-01-21

2002-04-07  Alexandre Duret-Lutz  <[email protected]>

	* src/media/sdl/joystick.c (get_joystick_state): Make sure we
	  never use SDL's Joystick API if it wasn't initialized.
	  Reported by William Black.

--- heroes-0.21.orig/src/media/sdl/joystick.c
    heroes-0.21/src/media/sdl/joystick.c
@@ -63,6  63,13 @@ char joyinit (void)
 
 void get_joystick_state (void)
 {
   /* Make sure we never use SDL's Joystick API if it wasn't
      initialized (this happens when the game is run with -J): crashes
      have been reported by a Windows user.  More generally, avoid
      these extra calls if no joystick was detected.  */
   if (joystick_detected == 0)
     return;
 
   SDL_JoystickUpdate();
   if (joystick[0]) {
     joystick_b[0] = (joystick_b[0] & ~1) |