Skip to content

Commit

Permalink
sdl: haptic.go: Fix HapticOpened() returning error on success
Browse files Browse the repository at this point in the history
Signed-off-by: Lilis Iskandar <lilis@veand.co>
  • Loading branch information
veeableful committed Nov 23, 2017
1 parent 67931a3 commit b50c282
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sdl/haptic.go
Expand Up @@ -225,7 +225,10 @@ func HapticOpen(index int) (*Haptic, error) {
// (https://wiki.libsdl.org/SDL_HapticOpened)
func HapticOpened(index int) (bool, error) {
ret := int(C.SDL_HapticOpened(C.int(index)))
return ret == C.SDL_TRUE, errorFromInt(ret)
if ret == 0 {
return false, GetError()
}
return ret == 1, nil
}

// HapticIndex returns the index of a haptic device.
Expand Down

0 comments on commit b50c282

Please sign in to comment.