Ticket #21007: NmeaParser.patch

File NmeaParser.patch, 1.3 KB (added by StephaneP, 3 months ago)

remove line endings when there is no checksum.

  • src/org/openstreetmap/josm/io/nmea/NmeaParser.java

     
    334334                    return false;
    335335                }
    336336            } else {
     337                // Since there is no checksum, we remove any line endings
     338                chkstrings[0] = chkstrings[0].replaceAll("\\r|\\n", "");
    337339                noChecksum++;
    338340            }
    339341            // now for the content
     
    443445                    }
    444446                }
    445447                // Age of differential correction
    446                 accu = e[GGA.GPS_AGE.position];
    447                 if (!accu.isEmpty() && currentwp != null) {
    448                     currentwp.put(GpxConstants.PT_AGEOFDGPSDATA, Float.valueOf(accu));
     448                if (GGA.GPS_AGE.position < e.length) {
     449                    accu = e[GGA.GPS_AGE.position];
     450                    if (!accu.isEmpty() && currentwp != null) {
     451                        currentwp.put(GpxConstants.PT_AGEOFDGPSDATA, Float.valueOf(accu));
     452                    }
    449453                }
    450454                // reference ID
    451455                if (GGA.REF.position < e.length) {