aboutsummaryrefslogtreecommitdiff
path: root/src/net/sourceforge/opentracking/TrackerEventHandler.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/sourceforge/opentracking/TrackerEventHandler.java')
-rw-r--r--src/net/sourceforge/opentracking/TrackerEventHandler.java24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/net/sourceforge/opentracking/TrackerEventHandler.java b/src/net/sourceforge/opentracking/TrackerEventHandler.java
index 28a8c8fad..18a15480f 100644
--- a/src/net/sourceforge/opentracking/TrackerEventHandler.java
+++ b/src/net/sourceforge/opentracking/TrackerEventHandler.java
@@ -43,16 +43,20 @@ public class TrackerEventHandler extends SimpleChannelHandler {
if (e.getMessage() instanceof Position) {
Position position = (Position) e.getMessage();
-
- System.out.println(
- "id: " + position.getId() +
- ", deviceId: " + position.getDeviceId() +
- ", valid: " + position.getValid() +
- ", time: " + position.getTime() +
- ", latitude: " + position.getLatitude() +
- ", longitude: " + position.getLongitude() +
- ", speed: " + position.getSpeed() +
- ", course: " + position.getCourse());
+
+ if (position == null) {
+ System.out.println("null message");
+ } else {
+ System.out.println(
+ "id: " + position.getId() +
+ ", deviceId: " + position.getDeviceId() +
+ ", valid: " + position.getValid() +
+ ", time: " + position.getTime() +
+ ", latitude: " + position.getLatitude() +
+ ", longitude: " + position.getLongitude() +
+ ", speed: " + position.getSpeed() +
+ ", course: " + position.getCourse());
+ }
// Write position to database
try {