aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2016-07-18 20:47:03 +0500
committerAbyss777 <abyss@fox5.ru>2016-07-18 20:47:03 +0500
commit919329b4a96247ca52e94b028589b8556615d456 (patch)
treec33f5eab10ca4d1788a216514ad19c545a09e52b /src
parent69b21e59dda3677a641adf8edeb78e31f76d8267 (diff)
downloadtrackermap-server-919329b4a96247ca52e94b028589b8556615d456.tar.gz
trackermap-server-919329b4a96247ca52e94b028589b8556615d456.tar.bz2
trackermap-server-919329b4a96247ca52e94b028589b8556615d456.zip
Fix nested if
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/protocol/TotemProtocolEncoder.java7
-rw-r--r--src/org/traccar/protocol/WondexProtocolEncoder.java7
2 files changed, 6 insertions, 8 deletions
diff --git a/src/org/traccar/protocol/TotemProtocolEncoder.java b/src/org/traccar/protocol/TotemProtocolEncoder.java
index 50e15075e..fb8e762c5 100644
--- a/src/org/traccar/protocol/TotemProtocolEncoder.java
+++ b/src/org/traccar/protocol/TotemProtocolEncoder.java
@@ -30,11 +30,10 @@ public class TotemProtocolEncoder extends StringProtocolEncoder {
command.set(Command.KEY_DEVICE_PASSWORD, "000000");
if (Context.getDeviceManager() != null) {
Device device = Context.getDeviceManager().getDeviceById(command.getDeviceId());
- if (device != null) {
- if (device.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) {
- command.set(Command.KEY_DEVICE_PASSWORD, device.getAttributes().get(Command.KEY_DEVICE_PASSWORD).toString());
+ if (device != null && device.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) {
+ command.set(Command.KEY_DEVICE_PASSWORD, device.getAttributes()
+ .get(Command.KEY_DEVICE_PASSWORD).toString());
}
- }
}
switch (command.getType()) {
diff --git a/src/org/traccar/protocol/WondexProtocolEncoder.java b/src/org/traccar/protocol/WondexProtocolEncoder.java
index 20341ae8d..7a323e4a8 100644
--- a/src/org/traccar/protocol/WondexProtocolEncoder.java
+++ b/src/org/traccar/protocol/WondexProtocolEncoder.java
@@ -13,11 +13,10 @@ public class WondexProtocolEncoder extends StringProtocolEncoder {
command.set(Command.KEY_DEVICE_PASSWORD, "0000");
if (Context.getDeviceManager() != null) {
Device device = Context.getDeviceManager().getDeviceById(command.getDeviceId());
- if (device != null) {
- if (device.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) {
- command.set(Command.KEY_DEVICE_PASSWORD, device.getAttributes().get(Command.KEY_DEVICE_PASSWORD).toString());
+ if (device != null && device.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) {
+ command.set(Command.KEY_DEVICE_PASSWORD, device.getAttributes()
+ .get(Command.KEY_DEVICE_PASSWORD).toString());
}
- }
}
switch (command.getType()) {