aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2022-01-15 23:45:02 -0800
committerAnton Tananaev <anton.tananaev@gmail.com>2022-01-15 23:45:02 -0800
commit071f038906ebcd29a42803e32ffe65efde57dbb6 (patch)
tree38adc7021df441daa1fc686c80e5373a18be54a7 /src/main/java
parent93a341b3232863161f9422beae34f0782dc86a29 (diff)
downloadtrackermap-server-071f038906ebcd29a42803e32ffe65efde57dbb6.tar.gz
trackermap-server-071f038906ebcd29a42803e32ffe65efde57dbb6.tar.bz2
trackermap-server-071f038906ebcd29a42803e32ffe65efde57dbb6.zip
Handle null pointer
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java b/src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java
index 8f828beff..daef923b0 100644
--- a/src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java
+++ b/src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java
@@ -44,11 +44,14 @@ public class OrbcommProtocolDecoder extends BaseProtocolDecoder {
String content = response.content().toString(StandardCharsets.UTF_8);
JsonObject json = Json.createReader(new StringReader(content)).readObject();
- OrbcommProtocolPoller poller = BasePipelineFactory.getHandler(channel.pipeline(), OrbcommProtocolPoller.class);
- if (poller != null) {
- DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
- poller.setStartTime(dateFormat.parse(json.getString("NextStartUTC")));
+ if (channel != null) {
+ OrbcommProtocolPoller poller =
+ BasePipelineFactory.getHandler(channel.pipeline(), OrbcommProtocolPoller.class);
+ if (poller != null) {
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ poller.setStartTime(dateFormat.parse(json.getString("NextStartUTC")));
+ }
}
return null;