1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 00:31:58 +00:00

Check read_array return value in drain_rx_buffer_

This commit is contained in:
J. Nick Koston
2026-02-07 00:18:51 +01:00
parent 25762c62f8
commit 8f6e1abbce

View File

@@ -122,7 +122,9 @@ void Dsmr::drain_rx_buffer_() {
uint8_t buf[64]; uint8_t buf[64];
int avail; int avail;
while ((avail = this->available()) > 0) { while ((avail = this->available()) > 0) {
this->read_array(buf, std::min(static_cast<size_t>(avail), sizeof(buf))); if (!this->read_array(buf, std::min(static_cast<size_t>(avail), sizeof(buf)))) {
break;
}
} }
} }