From 41452fab63229b272744ce1cf1d94b8e100b68de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Tue, 6 Mar 2012 17:58:11 +0100 Subject: [PATCH] cleaned up and corrected setValuesFromOptions --- .../de/ctdo/bunti/model/BuntiDMXDevice.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/de/ctdo/bunti/model/BuntiDMXDevice.java b/src/main/java/de/ctdo/bunti/model/BuntiDMXDevice.java index 99c8859..73a9110 100644 --- a/src/main/java/de/ctdo/bunti/model/BuntiDMXDevice.java +++ b/src/main/java/de/ctdo/bunti/model/BuntiDMXDevice.java @@ -127,20 +127,16 @@ public abstract class BuntiDMXDevice extends BuntiDevice { public final boolean setValuesFromOptions(Map options) { for (Entry opt : options.entrySet()) { - - DMXChannel channel = dmxChannels.getChannelByName(opt.getKey()); - - if(channel != null) { - try { - int value = Integer.parseInt(opt.getValue().toString()); - - setChannelValueByName(channel.getName(), value); - - } catch (Exception e) { - return false; - } - } - } + try { + int value = Integer.parseInt(opt.getValue().toString()); + + if(!setChannelValueByName(opt.getKey(), value)) { + return false; + } + } catch (Exception e) { + return false; + } + } return true; }