aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/protocol/AtrackProtocolDecoder.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/org/traccar/protocol/AtrackProtocolDecoder.java b/src/org/traccar/protocol/AtrackProtocolDecoder.java
index 1b10f7fa1..49f44a4f0 100644
--- a/src/org/traccar/protocol/AtrackProtocolDecoder.java
+++ b/src/org/traccar/protocol/AtrackProtocolDecoder.java
@@ -128,8 +128,10 @@ public class AtrackProtocolDecoder extends BaseProtocolDecoder {
cellTower.setLocationAreaCode(Integer.parseInt(values[i]));
break;
case "CN":
- cellTower.setMobileCountryCode(Integer.parseInt(values[i].substring(0, 3)));
- cellTower.setMobileNetworkCode(Integer.parseInt(values[i].substring(3)));
+ if (values[i].length() > 3) {
+ cellTower.setMobileCountryCode(Integer.parseInt(values[i].substring(0, 3)));
+ cellTower.setMobileNetworkCode(Integer.parseInt(values[i].substring(3)));
+ }
break;
case "PC":
position.set(Position.PREFIX_COUNT + 1, Integer.parseInt(values[i]));