From 7dc66ca1b2079f7572fe013fea74a52f6f93fa72 Mon Sep 17 00:00:00 2001 From: Edgar Simo Date: Sun, 24 Aug 2008 17:41:22 +0000 Subject: [PATCH] Fixed linux implementation of SDL_HapticStopAll. --- src/haptic/linux/SDL_syshaptic.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/haptic/linux/SDL_syshaptic.c b/src/haptic/linux/SDL_syshaptic.c index 42d5e2146..afa5ea5b5 100644 --- a/src/haptic/linux/SDL_syshaptic.c +++ b/src/haptic/linux/SDL_syshaptic.c @@ -916,16 +916,18 @@ SDL_SYS_HapticUnpause(SDL_Haptic * haptic) int SDL_SYS_HapticStopAll(SDL_Haptic * haptic) { - int i, ret;; + int i, ret; + /* Linux does not support this natively so we have to loop. */ for (i=0; ineffects; i++) { - ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]); - if (ret < 0) { - SDL_SetError("Haptic: Error while trying to stop all playing effects."); - return -1; + if (haptic->effects[i].hweffect != NULL) { + ret = SDL_SYS_HapticStopEffect(haptic, &haptic->effects[i]); + if (ret < 0) { + SDL_SetError("Haptic: Error while trying to stop all playing effects."); + return -1; + } } } - return 0; }