aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper/Parser.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-10-14 11:09:14 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-10-14 11:09:14 +1300
commit766064092ca4f85eacfa741e1ff772ea5b981d1a (patch)
tree2bb9257da7143fef2c4605c4a9d29db768986848 /src/org/traccar/helper/Parser.java
parent173d054219f1e37e7089c23cac0f530915834ee4 (diff)
downloadtrackermap-server-766064092ca4f85eacfa741e1ff772ea5b981d1a.tar.gz
trackermap-server-766064092ca4f85eacfa741e1ff772ea5b981d1a.tar.bz2
trackermap-server-766064092ca4f85eacfa741e1ff772ea5b981d1a.zip
Handle empty capture groups
Diffstat (limited to 'src/org/traccar/helper/Parser.java')
-rw-r--r--src/org/traccar/helper/Parser.java14
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)