diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/traccar/MainModule.java | 17 | ||||
-rw-r--r-- | src/main/java/org/traccar/config/Keys.java | 3 |
2 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/org/traccar/MainModule.java b/src/main/java/org/traccar/MainModule.java index 950a7278a..b7bdbc6bf 100644 --- a/src/main/java/org/traccar/MainModule.java +++ b/src/main/java/org/traccar/MainModule.java @@ -341,14 +341,17 @@ public class MainModule extends AbstractModule { @Provides public static BroadcastService provideBroadcastService( Config config, ObjectMapper objectMapper) throws IOException { - switch (config.getString(Keys.BROADCAST_TYPE)) { - case "multicast": - return new MulticastBroadcastService(config, objectMapper); - case "redis": - return new RedisBroadcastService(config, objectMapper); - default: - return new NullBroadcastService(); + if (config.hasKey(Keys.BROADCAST_TYPE)) { + switch (config.getString(Keys.BROADCAST_TYPE)) { + case "multicast": + return new MulticastBroadcastService(config, objectMapper); + case "redis": + return new RedisBroadcastService(config, objectMapper); + default: + break; + } } + return new NullBroadcastService(); } @Singleton diff --git a/src/main/java/org/traccar/config/Keys.java b/src/main/java/org/traccar/config/Keys.java index 78e081ce5..1ff1d1b51 100644 --- a/src/main/java/org/traccar/config/Keys.java +++ b/src/main/java/org/traccar/config/Keys.java @@ -1761,8 +1761,7 @@ public final class Keys { */ public static final ConfigKey<String> BROADCAST_TYPE = new StringConfigKey( "broadcast.type", - List.of(KeyType.CONFIG), - ""); + List.of(KeyType.CONFIG)); /** * Multicast interface. It can be either an IP address or an interface name. |