diff options
Diffstat (limited to 'src/org/traccar/database/DeviceManager.java')
-rw-r--r-- | src/org/traccar/database/DeviceManager.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/org/traccar/database/DeviceManager.java b/src/org/traccar/database/DeviceManager.java index 3b7e5c617..a485d6dc6 100644 --- a/src/org/traccar/database/DeviceManager.java +++ b/src/org/traccar/database/DeviceManager.java @@ -392,7 +392,12 @@ public class DeviceManager extends BaseObjectManager<Device> implements Identity } public DeviceState getDeviceState(long deviceId) { - return deviceStates.get(deviceId); + DeviceState deviceState = deviceStates.get(deviceId); + if (deviceState == null) { + deviceState = new DeviceState(); + deviceStates.put(deviceId, deviceState); + } + return deviceState; } public void setDeviceState(long deviceId, DeviceState deviceState) { |