Skip to content

Commit

Permalink
fix NULL pointer
Browse files Browse the repository at this point in the history
  • Loading branch information
amatilda committed Sep 5, 2024
1 parent f2a694a commit b1caa0c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hardware/arduino/zunoG2/libraries/ZMEButtons/ZMEButtons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,15 @@ bool ZMEVirtButtons::isReleased(uint8_t channel) {
return !isChannelPressed(channel, d);
}
bool ZMEVirtButtons::isIdled(uint8_t channel) {
ZMEButtonState_t *s;
uint8_t st;

zunoEnterCritical();
ZMEButtonState_t * s = _extractChannelState(channel);
uint8_t st = s->state;
s = _extractChannelState(channel);
if (s != NULL)
st = s->state;
else
st = ZMEBUTTON_STATE_IDLE;
zunoExitCritical();
return st == ZMEBUTTON_STATE_IDLE;
}
Expand Down

0 comments on commit b1caa0c

Please sign in to comment.