mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-16 12:51:47 +00:00
Add null check
This commit is contained in:
parent
693507d759
commit
24fae67788
@ -1,3 +1,3 @@
|
||||
# Tap dance state removed from `tap_dance_action_t`
|
||||
|
||||
Code that accessed the tap dance state as a field in the tap dance action should now call `tap_dance_get_state(int tap_dance_idx)` instead.
|
||||
Code that accessed the tap dance state as a field in the tap dance action should now call `tap_dance_get_state(int tap_dance_idx)` instead. That function may return `NULL` if many tap dance keys are held together. Add a `NULL` check before using the returned state.
|
||||
|
@ -215,7 +215,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
case TD(CT_CLN):
|
||||
action = tap_dance_get(QK_TAP_DANCE_GET_INDEX(keycode));
|
||||
state = tap_dance_get_state(QK_TAP_DANCE_GET_INDEX(keycode));
|
||||
if (!record->event.pressed && state->count && !state->finished) {
|
||||
if (!record->event.pressed && state != NULL && state->count && !state->finished) {
|
||||
tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)action->user_data;
|
||||
tap_code16(tap_hold->tap);
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
case TD(CT_CLN):
|
||||
action = tap_dance_get(QK_TAP_DANCE_GET_INDEX(keycode));
|
||||
state = tap_dance_get_state(QK_TAP_DANCE_GET_INDEX(keycode));
|
||||
if (!record->event.pressed && state->count && !state->finished) {
|
||||
if (!record->event.pressed && state != NULL && state->count && !state->finished) {
|
||||
tap_dance_tap_hold_t *tap_hold = (tap_dance_tap_hold_t *)action->user_data;
|
||||
tap_code16(tap_hold->tap);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user