diff options
| author | Teddy Wing | 2018-08-29 12:12:14 +0200 |
|---|---|---|
| committer | Teddy Wing | 2018-08-29 12:12:14 +0200 |
| commit | b8b09aa2ef1e945aaf7283de63d1d1f57585373b (patch) | |
| tree | 761befbd576cc9b302c21c63f6810360c0feca30 /src | |
| parent | 5d2685b89e891a8049fbbc635909b556c804eee7 (diff) | |
| download | dome-key-map-b8b09aa2ef1e945aaf7283de63d1d1f57585373b.tar.bz2 | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/cocoa_bridge.rs | 7 |
1 files changed, 4 insertions, 3 deletions
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) { |
