aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/WondexProtocolEncoder.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/org/traccar/protocol/WondexProtocolEncoder.java')
-rw-r--r--src/org/traccar/protocol/WondexProtocolEncoder.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/org/traccar/protocol/WondexProtocolEncoder.java b/src/org/traccar/protocol/WondexProtocolEncoder.java
index 7a323e4a8..568ca6aa0 100644
--- a/src/org/traccar/protocol/WondexProtocolEncoder.java
+++ b/src/org/traccar/protocol/WondexProtocolEncoder.java
@@ -11,12 +11,10 @@ public class WondexProtocolEncoder extends StringProtocolEncoder {
protected Object encodeCommand(Command command) {
command.set(Command.KEY_DEVICE_PASSWORD, "0000");
- if (Context.getDeviceManager() != null) {
- Device device = Context.getDeviceManager().getDeviceById(command.getDeviceId());
- if (device != null && device.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) {
- command.set(Command.KEY_DEVICE_PASSWORD, device.getAttributes()
- .get(Command.KEY_DEVICE_PASSWORD).toString());
- }
+ Device device = Context.getIdentityManager().getDeviceById(command.getDeviceId());
+ if (device.getAttributes().containsKey(Command.KEY_DEVICE_PASSWORD)) {
+ command.set(Command.KEY_DEVICE_PASSWORD, (String) device.getAttributes()
+ .get(Command.KEY_DEVICE_PASSWORD));
}
switch (command.getType()) {