diff --git a/src/Network/garmin.cxx b/src/Network/garmin.cxx index 6a0814b72..40238c1ad 100644 --- a/src/Network/garmin.cxx +++ b/src/Network/garmin.cxx @@ -373,7 +373,7 @@ bool FGGarmin::process() { return false; } } else if ( get_direction() == in ) { - if ( length = io->readline( buf, FG_MAX_MSG_SIZE ) ) { + if ( (length = io->readline( buf, FG_MAX_MSG_SIZE )) > 0 ) { FG_LOG( FG_IO, FG_ALERT, "Success reading data." ); if ( parse_message() ) { FG_LOG( FG_IO, FG_ALERT, "Success parsing data." ); @@ -384,7 +384,7 @@ bool FGGarmin::process() { FG_LOG( FG_IO, FG_ALERT, "Error reading data." ); return false; } - if ( length = io->readline( buf, FG_MAX_MSG_SIZE ) ) { + if ( (length = io->readline( buf, FG_MAX_MSG_SIZE )) > 0 ) { FG_LOG( FG_IO, FG_ALERT, "Success reading data." ); if ( parse_message() ) { FG_LOG( FG_IO, FG_ALERT, "Success parsing data." ); diff --git a/src/Network/nmea.cxx b/src/Network/nmea.cxx index 7eeb98827..d32d6953d 100644 --- a/src/Network/nmea.cxx +++ b/src/Network/nmea.cxx @@ -476,13 +476,13 @@ bool FGNMEA::process() { return false; } } else if ( get_direction() == in ) { - if ( length = io->readline( buf, FG_MAX_MSG_SIZE ) ) { + if ( (length = io->readline( buf, FG_MAX_MSG_SIZE )) > 0 ) { parse_message(); } else { FG_LOG( FG_IO, FG_ALERT, "Error reading data." ); return false; } - if ( length = io->readline( buf, FG_MAX_MSG_SIZE ) ) { + if ( (length = io->readline( buf, FG_MAX_MSG_SIZE )) > 0 ) { parse_message(); } else { FG_LOG( FG_IO, FG_ALERT, "Error reading data." );