src/haptic/SDL_haptic.c
changeset 3080 4094b4f1c3a1
parent 2713 0906692aa6a4
child 3232 aa8de4b80772
     1.1 --- a/src/haptic/SDL_haptic.c	Sat Feb 21 18:02:55 2009 +0000
     1.2 +++ b/src/haptic/SDL_haptic.c	Sat Feb 21 18:03:22 2009 +0000
     1.3 @@ -66,13 +66,20 @@
     1.4      int valid;
     1.5  
     1.6      valid = 0;
     1.7 -    for (i = 0; i < SDL_numhaptics; i++) {
     1.8 -        if (SDL_haptics[i] == haptic) {
     1.9 -            valid = 1;
    1.10 -            break;
    1.11 +    if (haptic != NULL) {
    1.12 +        for (i = 0; i < SDL_numhaptics; i++) {
    1.13 +            if (SDL_haptics[i] == haptic) {
    1.14 +                valid = 1;
    1.15 +                break;
    1.16 +            }
    1.17          }
    1.18      }
    1.19  
    1.20 +    /* Create the error here. */
    1.21 +    if (valid == 0) {
    1.22 +        SDL_SetError("Haptic: Invalid haptic device identifier");
    1.23 +    }
    1.24 +
    1.25      return valid;
    1.26  }
    1.27