diff options
author | Teddy Wing | 2018-09-18 13:07:43 +0200 |
---|---|---|
committer | Teddy Wing | 2018-09-18 13:07:43 +0200 |
commit | 0bb1ce741dad346d98e041986fa786a75c6c4836 (patch) | |
tree | caea5a32cd04844010a1483b058e04d2a889ffb7 | |
parent | c01786e8672fff0448f1efedeeb6fc781a605384 (diff) | |
download | DomeKey-0bb1ce741dad346d98e041986fa786a75c6c4836.tar.bz2 |
HeadphoneKey(runAction): Fix EXC_BAD_ACCESS on undefined map
If no map was defined for a headphone button, the fields in the
`CKeyActionResult` `result` would be null pointers, causing the bad
access exception.
Before doing anything, check that the pointer points to something real.
Also, fix the `kind` check to use the `ActionKind_Map` enum now that the
`dome-key-map` library has been updated with the new definition of
`CKeyActionResult`.
-rw-r--r-- | DomeKey/HeadphoneKey.m | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/DomeKey/HeadphoneKey.m b/DomeKey/HeadphoneKey.m index 8144035..b6d783e 100644 --- a/DomeKey/HeadphoneKey.m +++ b/DomeKey/HeadphoneKey.m @@ -81,7 +81,8 @@ const CKeyActionResult *result = c_run_key_action(trigger, NULL); - if (*result->kind == MapKind_Map) { + if (result->kind && + *result->kind == ActionKind_Map) { const char *c = result->action; int i = 0; while (*c) { |