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