diff options
Diffstat (limited to 'src/org/traccar/helper/Parser.java')
-rw-r--r-- | src/org/traccar/helper/Parser.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/org/traccar/helper/Parser.java b/src/org/traccar/helper/Parser.java index 9b346d810..e89104094 100644 --- a/src/org/traccar/helper/Parser.java +++ b/src/org/traccar/helper/Parser.java @@ -45,15 +45,23 @@ public class Parser { } public int nextInt() { - return Integer.parseInt(next()); + return nextInt(10); } public int nextInt(int radix) { - return Integer.parseInt(next(), radix); + if (hasNext()) { + return Integer.parseInt(next(), radix); + } else { + return 0; + } } public double nextDouble() { - return Double.parseDouble(next()); + if (hasNext()) { + return Double.parseDouble(next()); + } else { + return 0.0; + } } // Format: (degrees)(minutes)(hemisphere) |