From a0f736b7aab3fa84db8193f5b1a760076fd527e6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Mon, 9 Feb 2026 04:35:11 -0600 Subject: [PATCH] Future-proof available() check to handle negative return values --- esphome/components/nextion/nextion.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/esphome/components/nextion/nextion.cpp b/esphome/components/nextion/nextion.cpp index 0bde05b305..aa01914729 100644 --- a/esphome/components/nextion/nextion.cpp +++ b/esphome/components/nextion/nextion.cpp @@ -397,8 +397,10 @@ bool Nextion::remove_from_q_(bool report_empty) { } void Nextion::process_serial_() { + // 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; }