Small fixes

This commit is contained in:
Victor Shcherb 2020-04-12 19:21:32 +02:00
parent 9cc1da2fb6
commit ec63b4ce11
2 changed files with 5 additions and 2 deletions

View file

@ -2061,8 +2061,10 @@ public class GPXUtilities {
} else if (tag.equals("speed")) {
try {
String value = readText(parser, "speed");
((WptPt) parse).speed = Float.parseFloat(value);
parse.getExtensionsToWrite().put("speed", value);
if (!Algorithms.isEmpty(value)) {
((WptPt) parse).speed = Float.parseFloat(value);
parse.getExtensionsToWrite().put("speed", value);
}
} catch (NumberFormatException e) {
}
} else if (tag.equals("link")) {

View file

@ -484,6 +484,7 @@ public class Algorithms {
ByteArrayOutputStream bous = new ByteArrayOutputStream();
GZIPOutputStream gzout = new GZIPOutputStream(bous);
gzout.write(str.getBytes());
gzout.close();
return bous.toByteArray();
} catch (IOException e) {
throw new IllegalStateException(e);