Future-proof available() check to handle negative return values

This commit is contained in:
J. Nick Koston
2026-02-09 04:34:32 -06:00
parent b544cf2ffe
commit d6e692e302

View File

@@ -275,8 +275,10 @@ void LD2410Component::restart_and_read_all_info() {
}
void LD2410Component::loop() {
// All current UART available() implementations return >= 0,
// use <= 0 to future-proof against any that may return negative on error.
int avail = this->available();
if (avail == 0) {
if (avail <= 0) {
return;
}