diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2020-04-20 16:17:24 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-20 16:17:24 -0700 |
commit | 29ae25be34fc55893eaed84603d7cb45a670ea0a (patch) | |
tree | bb82a66dc492552474d639e627427031d37aa3e4 | |
parent | 39c5734c2cfdb1ed92eb0801c73793c6603e394c (diff) | |
parent | b6870238babbb239a0ef8b62a1c45cab35ce3b87 (diff) | |
download | traccar-server-29ae25be34fc55893eaed84603d7cb45a670ea0a.tar.gz traccar-server-29ae25be34fc55893eaed84603d7cb45a670ea0a.tar.bz2 traccar-server-29ae25be34fc55893eaed84603d7cb45a670ea0a.zip |
Merge pull request #4519 from kgrosvenor/fix/object-manager-null-items
Ensure item is not null before adding to the collection in getItems
-rw-r--r-- | src/main/java/org/traccar/database/BaseObjectManager.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/database/BaseObjectManager.java b/src/main/java/org/traccar/database/BaseObjectManager.java index e274e5aba..d0024c005 100644 --- a/src/main/java/org/traccar/database/BaseObjectManager.java +++ b/src/main/java/org/traccar/database/BaseObjectManager.java @@ -158,7 +158,10 @@ public class BaseObjectManager<T extends BaseModel> { public final Collection<T> getItems(Set<Long> itemIds) { Collection<T> result = new LinkedList<>(); for (long itemId : itemIds) { - result.add(getById(itemId)); + T item = getById(itemId); + if (item != null) { + result.add(item); + } } return result; } |