From 8f6e1abbcef66bb038f60699b59918688d443046 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 7 Feb 2026 00:18:51 +0100 Subject: [PATCH] Check read_array return value in drain_rx_buffer_ --- esphome/components/dsmr/dsmr.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/dsmr/dsmr.cpp b/esphome/components/dsmr/dsmr.cpp index be43384330..88cfff2e4b 100644 --- a/esphome/components/dsmr/dsmr.cpp +++ b/esphome/components/dsmr/dsmr.cpp @@ -122,7 +122,9 @@ void Dsmr::drain_rx_buffer_() { uint8_t buf[64]; int avail; while ((avail = this->available()) > 0) { - this->read_array(buf, std::min(static_cast(avail), sizeof(buf))); + if (!this->read_array(buf, std::min(static_cast(avail), sizeof(buf)))) { + break; + } } }