Skip to content

Commit

Permalink
validate_int in haptic
Browse files Browse the repository at this point in the history
  • Loading branch information
ticky committed Oct 10, 2017
1 parent e9ce0b2 commit 6b3b0b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sdl2/haptic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ use sys::haptic as ll;
use sys::joystick as sys_joystick;

use HapticSubsystem;
use common::IntegerOrSdlError;
use common::{validate_int, IntegerOrSdlError};
use get_error;

impl HapticSubsystem {
/// Attempt to open the joystick at index `joystick_index` and return its haptic device.
pub fn open_from_joystick_id(&self, joystick_index: u32) -> Result<Haptic, IntegerOrSdlError> {
use common::IntegerOrSdlError::*;
let joystick_index = try!(validate_int(joystick_index, "joystick_index"));

let haptic = unsafe {
let joystick = sys_joystick::SDL_JoystickOpen(joystick_index);
Expand Down

0 comments on commit 6b3b0b9

Please sign in to comment.