From 063ca2ff893a3db3977a42ea960787b067c549db Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Mon, 11 Jul 2016 22:59:59 +1200 Subject: Check if geofence exists --- src/org/traccar/database/GeofenceManager.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/org') diff --git a/src/org/traccar/database/GeofenceManager.java b/src/org/traccar/database/GeofenceManager.java index d3cf2ad1f..e1eb042c8 100644 --- a/src/org/traccar/database/GeofenceManager.java +++ b/src/org/traccar/database/GeofenceManager.java @@ -153,7 +153,8 @@ public class GeofenceManager { Position lastPosition = Context.getConnectionManager().getLastPosition(device.getId()); if (lastPosition != null && deviceGeofencesWithGroups.containsKey(device.getId())) { for (Long geofenceId : deviceGeofencesWithGroups.get(device.getId())) { - if (getGeofence(geofenceId).getGeometry() + Geofence geofence = getGeofence(geofenceId); + if (geofence != null && geofence.getGeometry() .containsPoint(lastPosition.getLatitude(), lastPosition.getLongitude())) { deviceGeofenceIds.add(geofenceId); } -- cgit v1.2.3