changeset 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 446054caaa81
files src/haptic/win32/SDL_syshaptic.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
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;