From 919329b4a96247ca52e94b028589b8556615d456 Mon Sep 17 00:00:00 2001 From: Abyss777 Date: Mon, 18 Jul 2016 20:47:03 +0500 Subject: Fix nested if --- src/org/traccar/protocol/TotemProtocolEncoder.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/org/traccar/protocol/TotemProtocolEncoder.java') 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()) { -- cgit v1.2.3