diff src/haptic/win32/SDL_syshaptic.c @ 2621:83659de20bf2 gsoc2008_force_feedback

Forgot to alloc the hwdata when opening from joystick.
author Edgar Simo <bobbens@gmail.com>
date Wed, 06 Aug 2008 09:28:07 +0000
parents 4d91a53c6f8a
children 6deba05725ac
line wrap: on
line diff
--- a/src/haptic/win32/SDL_syshaptic.c	Wed Aug 06 09:24:08 2008 +0000
+++ b/src/haptic/win32/SDL_syshaptic.c	Wed Aug 06 09:28:07 2008 +0000
@@ -565,6 +565,16 @@
 {
    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;