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:
@@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user