Skip to content
This repository has been archived by the owner on May 7, 2020. It is now read-only.

Commit

Permalink
Avoid NPE while handling INCREASE/DECREASE commands (#3895)
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
  • Loading branch information
cweitkamp authored and kaikreuzer committed Jul 26, 2017
1 parent 5c4a676 commit 9a01200
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -181,7 +181,7 @@ private void handleBrightnessCommand(Command command) {
} else if (command instanceof OnOffType) {
setState(((OnOffType) command));
} else if (command instanceof IncreaseDecreaseType) {
if (state != null) {
if (state != null && state.getBrightness() != null) {
int current = state.getBrightness().intValue();
if (IncreaseDecreaseType.INCREASE.equals(command)) {
setBrightness(new PercentType(Math.min(current + STEP, PercentType.HUNDRED.intValue())));
Expand All @@ -200,7 +200,7 @@ private void handleColorTemperatureCommand(Command command) {
if (command instanceof PercentType) {
setColorTemperature((PercentType) command);
} else if (command instanceof IncreaseDecreaseType) {
if (state != null) {
if (state != null && state.getColorTemperature() != null) {
int current = state.getColorTemperature().intValue();
if (IncreaseDecreaseType.INCREASE.equals(command)) {
setColorTemperature(new PercentType(Math.min(current + STEP, PercentType.HUNDRED.intValue())));
Expand Down

0 comments on commit 9a01200

Please sign in to comment.