aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/notification/NotificationSms.java4
-rw-r--r--src/org/traccar/notification/NotificatorManager.java6
2 files changed, 7 insertions, 3 deletions
diff --git a/src/org/traccar/notification/NotificationSms.java b/src/org/traccar/notification/NotificationSms.java
index 34d68e174..a8eaff798 100644
--- a/src/org/traccar/notification/NotificationSms.java
+++ b/src/org/traccar/notification/NotificationSms.java
@@ -27,7 +27,7 @@ public final class NotificationSms extends Notificator {
@Override
public void sendAsync(long userId, Event event, Position position) {
User user = Context.getPermissionsManager().getUser(userId);
- if (Context.getSmsManager() != null && user.getPhone() != null) {
+ if (user.getPhone() != null) {
Context.getStatisticsManager().registerSms();
Context.getSmsManager().sendMessageAsync(user.getPhone(),
NotificationFormatter.formatSmsMessage(userId, event, position), false);
@@ -38,7 +38,7 @@ public final class NotificationSms extends Notificator {
public void sendSync(long userId, Event event, Position position) throws SMSException,
InterruptedException {
User user = Context.getPermissionsManager().getUser(userId);
- if (Context.getSmsManager() != null && user.getPhone() != null) {
+ if (user.getPhone() != null) {
Context.getStatisticsManager().registerSms();
Context.getSmsManager().sendMessageSync(user.getPhone(),
NotificationFormatter.formatSmsMessage(userId, event, position), false);
diff --git a/src/org/traccar/notification/NotificatorManager.java b/src/org/traccar/notification/NotificatorManager.java
index 814c8dc1a..1aa76beff 100644
--- a/src/org/traccar/notification/NotificatorManager.java
+++ b/src/org/traccar/notification/NotificatorManager.java
@@ -19,6 +19,8 @@ package org.traccar.notification;
import java.util.HashMap;
import java.util.Map;
+import org.traccar.Context;
+
public class NotificatorManager {
protected NotificatorManager() {
@@ -29,7 +31,9 @@ public class NotificatorManager {
private static final Notificator NULL_NOTIFICATOR = new NotificationNull();
static {
- NOTIFICATORS.put("sms", new NotificationSms());
+ if (Context.getSmsManager() != null) {
+ NOTIFICATORS.put("sms", new NotificationSms());
+ }
NOTIFICATORS.put("mail", new NotificationMail());
NOTIFICATORS.put("web", new NotificationWeb());
}