From fbc66132e32bf91a5f8ccd9d5b2307961492669f Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 11 Jul 2023 17:05:31 +1000 Subject: [PATCH] AP_ADSB: correct bad port read in Sagetech driver --- libraries/AP_ADSB/AP_ADSB_Sagetech.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/AP_ADSB/AP_ADSB_Sagetech.cpp b/libraries/AP_ADSB/AP_ADSB_Sagetech.cpp index 6e610f9e90..5724ec9239 100644 --- a/libraries/AP_ADSB/AP_ADSB_Sagetech.cpp +++ b/libraries/AP_ADSB/AP_ADSB_Sagetech.cpp @@ -69,8 +69,8 @@ void AP_ADSB_Sagetech::update() // ----------------------------- uint32_t nbytes = MIN(_port->available(), 10 * PAYLOAD_XP_MAX_SIZE); while (nbytes-- > 0) { - const int16_t data = (uint8_t)_port->read(); - if (data < 0) { + uint8_t data; + if (!_port->read(data)) { break; } if (parse_byte_XP((uint8_t)data)) {