forked from upstream-mirrors/OpenTracks
bug fix, handle the case when gx:value in kml is empty
This commit is contained in:
+19
-14
@@ -293,20 +293,25 @@ 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) {
|
||||||
int value;
|
return;
|
||||||
try {
|
}
|
||||||
value = Integer.parseInt(content.trim());
|
content = content.trim();
|
||||||
} catch (NumberFormatException e) {
|
if (content.equals("")) {
|
||||||
throw new SAXException(createErrorMessage("Unable to parse gx:value:" + content), e);
|
return;
|
||||||
}
|
}
|
||||||
if (POWER.equals(sensorName)) {
|
int value;
|
||||||
powerList.add(value);
|
try {
|
||||||
} else if (HEART_RATE.equals(sensorName)) {
|
value = Integer.parseInt(content);
|
||||||
heartRateList.add(value);
|
} catch (NumberFormatException e) {
|
||||||
} else if (CADENCE.equals(sensorName)) {
|
throw new SAXException(createErrorMessage("Unable to parse gx:value:" + content), e);
|
||||||
cadenceList.add(value);
|
}
|
||||||
}
|
if (POWER.equals(sensorName)) {
|
||||||
|
powerList.add(value);
|
||||||
|
} else if (HEART_RATE.equals(sensorName)) {
|
||||||
|
heartRateList.add(value);
|
||||||
|
} else if (CADENCE.equals(sensorName)) {
|
||||||
|
cadenceList.add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user