Changeset 1049 in josm for trunk/src/org
- Timestamp:
- 2008-10-21T20:49:20+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r999 r1049 9 9 import java.io.InputStreamReader; 10 10 import java.util.ArrayList; 11 import java.util.Arrays; 11 12 import java.util.Collection; 12 13 … … 140 141 // XXX: No need for it: String checksum = nmeaAndChecksum[1]; 141 142 String[] e = nmea.split(","); 143 if (e.length == 0) { 144 continue; 145 } 142 146 if (NMEA_TYPE.GPRMC.equals(e[TYPE])) { 143 147 LatLon latLon = parseLatLon(e); … … 157 161 158 162 private LatLon parseLatLon(String[] e) throws NumberFormatException { 159 String widthNorth = e[GPRMC.WIDTH_NORTH.position].trim(); 163 // If the array looks bogus don't try to get valuable information from it 164 if (e.length != 13) { 165 return null; 166 } 167 String widthNorth = e[GPRMC.WIDTH_NORTH.position].trim(); 160 168 String lengthEast = e[GPRMC.LENGTH_EAST.position].trim(); 161 169 if ("".equals(widthNorth) || "".equals(lengthEast)) {
Note:
See TracChangeset
for help on using the changeset viewer.