aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2023-05-29 11:00:18 -0700
committerGitHub <noreply@github.com>2023-05-29 11:00:18 -0700
commit9dd1a898277c3304865ff306a7cf306b8b95e44b (patch)
tree1947e98e50ba66f61bf7503397dc10a45f6b7171
parentf469e52c72b3fca6f4bff8667e1e3095f2a265f2 (diff)
parentd244b4bc4999ba3e3dca607bf797c3f7d7f578ff (diff)
downloadtrackermap-server-9dd1a898277c3304865ff306a7cf306b8b95e44b.tar.gz
trackermap-server-9dd1a898277c3304865ff306a7cf306b8b95e44b.tar.bz2
trackermap-server-9dd1a898277c3304865ff306a7cf306b8b95e44b.zip
Merge pull request #5095 from merabtenei/attributes-NullPointerException
fix NullPointerException when attribute key is defined and value is null
-rw-r--r--src/main/java/org/traccar/model/ExtendedModel.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/model/ExtendedModel.java b/src/main/java/org/traccar/model/ExtendedModel.java
index 6a4f502f7..d5cd094da 100644
--- a/src/main/java/org/traccar/model/ExtendedModel.java
+++ b/src/main/java/org/traccar/model/ExtendedModel.java
@@ -91,7 +91,8 @@ public class ExtendedModel extends BaseModel {
public String getString(String key, String defaultValue) {
if (attributes.containsKey(key)) {
- return attributes.get(key).toString();
+ Object value = attributes.get(key);
+ return value != null ? value.toString() : null;
} else {
return defaultValue;
}