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

This commit is contained in:
J. Nick Koston
2026-02-09 04:32:14 -06:00
parent 901192cca1
commit 68dfb844bd
+3 -1
View File
@@ -276,8 +276,10 @@ void LD2450Component::dump_config() {
}
void LD2450Component::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;
}