From 01eae916a1b2f39664dbeea2fcf7fb45158f8212 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 4 Jan 2018 01:16:04 +1300 Subject: Avoid photo null pointer exception --- src/org/traccar/protocol/MeitrackProtocolDecoder.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/org/traccar') diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 259283c19..3de71fa14 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -459,6 +459,10 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { switch (type) { case "D00": + if (photo == null) { + return null; + } + index = buf.indexOf(index + 1 + type.length() + 1, buf.writerIndex(), (byte) ',') + 1; int endIndex = buf.indexOf(index, buf.writerIndex(), (byte) ','); int total = Integer.parseInt(buf.toString(index, endIndex - index, StandardCharsets.US_ASCII)); -- cgit v1.2.3