src/haptic/darwin/SDL_syshaptic.c
branchgsoc2008_force_feedback
changeset 2604 4eee4d565368
parent 2603 a84ce5ae8936
child 2608 7c7a63f22afa
--- a/src/haptic/darwin/SDL_syshaptic.c	Tue Aug 05 15:56:35 2008 +0000
+++ b/src/haptic/darwin/SDL_syshaptic.c	Tue Aug 05 16:02:56 2008 +0000
@@ -555,14 +555,18 @@
       case SDL_HAPTIC_CARTESIAN:
          effect->dwFlags |= FFEFF_CARTESIAN;
          rglDir[0] = dir->dir[0];
-         rglDir[1] = dir->dir[1];
-         rglDir[2] = dir->dir[2];
+         if (naxes > 1)
+            rglDir[1] = dir->dir[1];
+         if (naxes > 2)
+            rglDir[2] = dir->dir[2];
          return 0;
       case SDL_HAPTIC_SPHERICAL:
          effect->dwFlags |= FFEFF_SPHERICAL;
          rglDir[0] = dir->dir[0];
-         rglDir[1] = dir->dir[1];
-         rglDir[2] = dir->dir[2];
+         if (naxes > 1)
+            rglDir[1] = dir->dir[1];
+         if (naxes > 2)
+            rglDir[2] = dir->dir[2];
          return 0;
 
       default: