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

[Tradfri] Avoid NPE while handling INCREASE/DECREASE commands #3895

Merged
merged 1 commit into from Jul 26, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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