diff src/haptic/SDL_haptic.c @ 3080:4094b4f1c3a1

More verbosity and error checking.
author Edgar Simo <bobbens@gmail.com>
date Sat, 21 Feb 2009 18:03:22 +0000
parents 0906692aa6a4
children aa8de4b80772
line wrap: on
line diff
--- a/src/haptic/SDL_haptic.c	Sat Feb 21 18:02:55 2009 +0000
+++ b/src/haptic/SDL_haptic.c	Sat Feb 21 18:03:22 2009 +0000
@@ -66,13 +66,20 @@
     int valid;
 
     valid = 0;
-    for (i = 0; i < SDL_numhaptics; i++) {
-        if (SDL_haptics[i] == haptic) {
-            valid = 1;
-            break;
+    if (haptic != NULL) {
+        for (i = 0; i < SDL_numhaptics; i++) {
+            if (SDL_haptics[i] == haptic) {
+                valid = 1;
+                break;
+            }
         }
     }
 
+    /* Create the error here. */
+    if (valid == 0) {
+        SDL_SetError("Haptic: Invalid haptic device identifier");
+    }
+
     return valid;
 }