From 98fd364db65daf847b2b76819cd36602aaef8d25 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 20 Aug 2018 16:42:44 +1200 Subject: Handle zero MCC and MNC --- src/org/traccar/protocol/AtrackProtocolDecoder.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/org') 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])); -- cgit v1.2.3