From 19423aedc98811464acf1ce45f78002acc9a307c Mon Sep 17 00:00:00 2001 From: Edgar Simo Date: Wed, 6 Aug 2008 09:28:07 +0000 Subject: [PATCH] Forgot to alloc the hwdata when opening from joystick. --- src/haptic/win32/SDL_syshaptic.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/haptic/win32/SDL_syshaptic.c b/src/haptic/win32/SDL_syshaptic.c index 84418bff8..dd7911ba0 100644 --- a/src/haptic/win32/SDL_syshaptic.c +++ b/src/haptic/win32/SDL_syshaptic.c @@ -565,6 +565,16 @@ SDL_SYS_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) { int ret; + /* Allocate the hwdata */ + haptic->hwdata = (struct haptic_hwdata *) + SDL_malloc(sizeof(*haptic->hwdata)); + if (haptic->hwdata == NULL) { + SDL_OutOfMemory(); + return -1; + } + SDL_memset(haptic->hwdata, 0, sizeof(*haptic->hwdata)); + + /* Now open the device. */ ret = SDL_SYS_HapticOpenFromDevice2( haptic, joystick->hwdata->InputDevice ); if (ret < 0) { return -1;