From 5f432eaa2d45c139209d5a481eefccda56322ce1 Mon Sep 17 00:00:00 2001 From: Matthias Badaire Date: Mon, 19 Jan 2015 10:12:41 +0100 Subject: [PATCH] AP_Mount_Alexmos : take into account available negative numbers uartdriver->available () function brings back a signed int, we should be carefull to avoid an endless loop if that happens. --- libraries/AP_Mount/AP_Mount_Alexmos.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/AP_Mount/AP_Mount_Alexmos.cpp b/libraries/AP_Mount/AP_Mount_Alexmos.cpp index a70e60ff7b..5765162176 100644 --- a/libraries/AP_Mount/AP_Mount_Alexmos.cpp +++ b/libraries/AP_Mount/AP_Mount_Alexmos.cpp @@ -220,6 +220,11 @@ void AP_Mount_Alexmos::read_incoming() int16_t numc; numc = _port->available(); + + if (numc < 0 ){ + return; + } + for (int16_t i = 0; i < numc; i++) { // Process bytes received data = _port->read(); switch (_step) {