aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/traccar/protocol/OrbcommProtocolDecoder.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;