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

This commit is contained in:
J. Nick Koston
2026-02-09 04:34:14 -06:00
parent 67e7ba4812
commit 991ce396a9
+3 -1
View File
@@ -15,8 +15,10 @@ void CSE7766Component::loop() {
this->raw_data_index_ = 0;
}
// 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;
}