aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkieran <kierangrosvenor36@gmail.com>2020-04-21 00:00:28 +0100
committerkieran <kierangrosvenor36@gmail.com>2020-04-21 00:00:28 +0100
commitb6870238babbb239a0ef8b62a1c45cab35ce3b87 (patch)
treebb82a66dc492552474d639e627427031d37aa3e4
parent39c5734c2cfdb1ed92eb0801c73793c6603e394c (diff)
downloadtrackermap-server-b6870238babbb239a0ef8b62a1c45cab35ce3b87.tar.gz
trackermap-server-b6870238babbb239a0ef8b62a1c45cab35ce3b87.tar.bz2
trackermap-server-b6870238babbb239a0ef8b62a1c45cab35ce3b87.zip
Ensure item is not null before adding to the collection in getItems method of the BaseObjectManager
-rw-r--r--src/main/java/org/traccar/database/BaseObjectManager.java5
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;
}