From ec6fe22688ea0d4e642eeb5429e84ab753da9b4f Mon Sep 17 00:00:00 2001 From: David Cermak Date: Fri, 7 Jun 2024 12:12:45 +0200 Subject: [PATCH] fix(modem): Fix other clang-tidy warnings --- components/esp_modem/src/esp_modem_cmux.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/esp_modem/src/esp_modem_cmux.cpp b/components/esp_modem/src/esp_modem_cmux.cpp index b1bfc7877..c47e13b9d 100644 --- a/components/esp_modem/src/esp_modem_cmux.cpp +++ b/components/esp_modem/src/esp_modem_cmux.cpp @@ -150,7 +150,7 @@ bool CMux::data_available(uint8_t *data, size_t len) return false; } } else if ((type & FT_UIH) == FT_UIH && dlci == 0) { // notify the internal DISC command - if ((len > 0 && (data[0] & 0xE1) == 0xE1) || (data == nullptr)) { + if ((data == nullptr) || (len > 0 && (data[0] & 0xE1) == 0xE1)) { // Not a DISC, ignore (MSC frame) return true; } @@ -346,6 +346,9 @@ bool CMux::on_cmux_data(uint8_t *data, size_t actual_len) actual_len = term->read(data, buffer.size); #endif } + if (data == nullptr) { + return false; + } ESP_LOG_BUFFER_HEXDUMP("CMUX Received", data, actual_len, ESP_LOG_VERBOSE); CMuxFrame frame = { .ptr = data, .len = actual_len }; while (frame.len > 0) {