diff --git a/lib/irda/encoder_decoder/common/irda_common_decoder.c b/lib/irda/encoder_decoder/common/irda_common_decoder.c index b402ed14..e57844cc 100644 --- a/lib/irda/encoder_decoder/common/irda_common_decoder.c +++ b/lib/irda/encoder_decoder/common/irda_common_decoder.c @@ -257,7 +257,7 @@ void irda_common_decoder_reset_state(IrdaCommonDecoder* common_decoder) { common_decoder->databit_cnt = 0; common_decoder->switch_detect = false; common_decoder->message.protocol = IrdaProtocolUnknown; - if (common_decoder->protocol->timings.preamble_mark == 0) { + if ((common_decoder->protocol->timings.preamble_mark == 0) && (common_decoder->timings_cnt > 0)) { --common_decoder->timings_cnt; shift_left_array(common_decoder->timings, common_decoder->timings_cnt, 1); }