From b8b09aa2ef1e945aaf7283de63d1d1f57585373b Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Wed, 29 Aug 2018 12:12:14 +0200 Subject: c_run_key_action(): Make `trigger` argument nullable Actually, now that I think about it, the trigger argument shouldn't be nullable, since one should always be passed in. But this was really more of a test to make sure we could do the same for a new `mode` argument, which will also be a `Trigger`, but which might be null. --- src/cocoa_bridge.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/cocoa_bridge.rs b/src/cocoa_bridge.rs index 9392fcb..4d63c44 100644 --- a/src/cocoa_bridge.rs +++ b/src/cocoa_bridge.rs @@ -61,12 +61,13 @@ pub struct CKeyActionResult { #[no_mangle] pub extern "C" fn c_run_key_action( - trigger: Trigger, + trigger: *const Trigger, ) -> *const CKeyActionResult { let trigger = unsafe { - assert!(!trigger.buttons.is_null()); + assert!(!trigger.is_null()); + assert!(!(*trigger).buttons.is_null()); - slice::from_raw_parts(trigger.buttons, trigger.length as usize) + slice::from_raw_parts((*trigger).buttons, (*trigger).length as usize) }; let result = match run_key_action_for_mode(trigger, None) { -- cgit v1.2.3