aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-08-04 10:45:26 +0500
committerAbyss777 <abyss@fox5.ru>2016-08-04 10:45:26 +0500
commit870da4a100bedf1c21e43d6ab708de5c6a023c94 (patch)
tree726c0c6effdeced9903b6b26ef0480047d2d179c
parentb6f82f2b3894df234d528a5feb303f81d3620259 (diff)
downloadtrackermap-server-870da4a100bedf1c21e43d6ab708de5c6a023c94.tar.gz
trackermap-server-870da4a100bedf1c21e43d6ab708de5c6a023c94.tar.bz2
trackermap-server-870da4a100bedf1c21e43d6ab708de5c6a023c94.zip
Fix NullPointer exception without 'mail.smtp.username' in config.
-rw-r--r--src/org/traccar/notification/NotificationMail.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/org/traccar/notification/NotificationMail.java b/src/org/traccar/notification/NotificationMail.java
index a0b80d2ab..f9d42968f 100644
--- a/src/org/traccar/notification/NotificationMail.java
+++ b/src/org/traccar/notification/NotificationMail.java
@@ -55,9 +55,19 @@ public final class NotificationMail {
result.put("mail.smtp.ssl.trust", config.getBoolean("mail.smtp.ssl.trust"));
result.put("mail.smtp.auth", config.getBoolean("mail.smtp.auth"));
- result.put("mail.smtp.user", config.getString("mail.smtp.username", null));
- result.put("mail.smtp.password", config.getString("mail.smtp.password", null));
- result.put("mail.smtp.from", config.getString("mail.smtp.from", null));
+
+ String username = config.getString("mail.smtp.username");
+ if (username != null) {
+ result.put("mail.smtp.user", username);
+ }
+ String password = config.getString("mail.smtp.password");
+ if (password != null) {
+ result.put("mail.smtp.password", password);
+ }
+ String from = config.getString("mail.smtp.from");
+ if (from != null) {
+ result.put("mail.smtp.from", from);
+ }
}
return result;
}