From 991ce396a9e3ee9ceacdfbba612b5ec6cc789b48 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 9 Feb 2026 04:34:14 -0600 Subject: [PATCH] Future-proof available() check to handle negative return values --- esphome/components/cse7766/cse7766.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/cse7766/cse7766.cpp b/esphome/components/cse7766/cse7766.cpp index ae4b9c9316d..b4b282dff97 100644 --- a/esphome/components/cse7766/cse7766.cpp +++ b/esphome/components/cse7766/cse7766.cpp @@ -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; }