diff --git a/utils/TerraSync/terrasync.cxx b/utils/TerraSync/terrasync.cxx index 53520822a..e0f867ebf 100644 --- a/utils/TerraSync/terrasync.cxx +++ b/utils/TerraSync/terrasync.cxx @@ -243,8 +243,14 @@ static void parse_message( const string &msg, int *lat, int *lon ) { // find GGA string and advance to start of lat string::size_type pos = text.find( "$GPGGA" ); + if ( pos == string::npos ) + { + *lat = -9999.0; + *lon = -9999.0; + return; + } string tmp = text.substr( pos + 7 ); - pos = text.find( "," ); + pos = tmp.find( "," ); tmp = tmp.substr( pos + 1 ); // cout << "-> " << tmp << endl;