forked from upstream-mirrors/OpenTracks
bug fix, handle the case when gx:value in kml is empty
This commit is contained in:
+8
-3
@@ -293,10 +293,16 @@ public class KmlFileTrackImporter extends AbstractFileTrackImporter {
|
|||||||
* On sensor value end. gx:value end tag.
|
* On sensor value end. gx:value end tag.
|
||||||
*/
|
*/
|
||||||
private void onSensorValueEnd() throws SAXException {
|
private void onSensorValueEnd() throws SAXException {
|
||||||
if (content != null) {
|
if (content == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
content = content.trim();
|
||||||
|
if (content.equals("")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
int value;
|
int value;
|
||||||
try {
|
try {
|
||||||
value = Integer.parseInt(content.trim());
|
value = Integer.parseInt(content);
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
throw new SAXException(createErrorMessage("Unable to parse gx:value:" + content), e);
|
throw new SAXException(createErrorMessage("Unable to parse gx:value:" + content), e);
|
||||||
}
|
}
|
||||||
@@ -309,4 +315,3 @@ public class KmlFileTrackImporter extends AbstractFileTrackImporter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user