diff options
author | Anton Tananaev <anton@traccar.org> | 2022-06-06 19:05:20 -0700 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-06-06 19:05:20 -0700 |
commit | 59bbaa37656d1aacd7df21d70ec5bfa85cf98608 (patch) | |
tree | 499bea03ac0d00d0b44797b3524f731c690fb571 /src/main/java/org/traccar/session/cache | |
parent | 3b5c04b4ddf71223371815575fa1b652fea1d5da (diff) | |
download | trackermap-server-59bbaa37656d1aacd7df21d70ec5bfa85cf98608.tar.gz trackermap-server-59bbaa37656d1aacd7df21d70ec5bfa85cf98608.tar.bz2 trackermap-server-59bbaa37656d1aacd7df21d70ec5bfa85cf98608.zip |
Handle missing cache (fix #4861)
Diffstat (limited to 'src/main/java/org/traccar/session/cache')
-rw-r--r-- | src/main/java/org/traccar/session/cache/CacheManager.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/session/cache/CacheManager.java b/src/main/java/org/traccar/session/cache/CacheManager.java index aca3df52d..102a31ecd 100644 --- a/src/main/java/org/traccar/session/cache/CacheManager.java +++ b/src/main/java/org/traccar/session/cache/CacheManager.java @@ -69,7 +69,8 @@ public class CacheManager { public <T extends BaseModel> T getObject(Class<T> clazz, long id) { try { lock.readLock().lock(); - return deviceCache.get(new CacheKey(clazz, id)).getValue(); + var cacheValue = deviceCache.get(new CacheKey(clazz, id)); + return cacheValue != null ? cacheValue.getValue() : null; } finally { lock.readLock().unlock(); } |