]> git.mxchange.org Git - flightgear.git/commitdiff
Fix terrasync parsing of atlas messages
authorfredb <fredb>
Sun, 1 Feb 2009 18:05:24 +0000 (18:05 +0000)
committerTim Moore <timoore@redhat.com>
Sun, 1 Feb 2009 23:58:01 +0000 (00:58 +0100)
utils/TerraSync/terrasync.cxx

index 53520822a60aea9f7ae9952114b89c01b3e6761a..e0f867ebf0485942613a5a92aacf11a6e2bb2df3 100644 (file)
@@ -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;