Skip to content

Commit

Permalink
light_bulb: fix possible crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Markus Kirberg committed May 17, 2024
1 parent fb37c90 commit 19f70b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/shelly_hap_light_bulb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void LightBulb::SetColorTemperature(int color_temperature,
source != kChangeReasonAuto) {
color_temperature_characteristic->RaiseEvent();
}
if (source == kCHangeReasonHAP) {
if (source == kCHangeReasonHAP && ad_controller_ != nullptr) {
ad_controller_->ColorTempChangedManually();
}

Expand Down Expand Up @@ -267,7 +267,7 @@ void LightBulb::SetBrightness(int brightness, const std::string &source) {
if (brightness_characteristic != nullptr) {
brightness_characteristic->RaiseEvent();
}
if (source == kCHangeReasonHAP) {
if (source == kCHangeReasonHAP && ad_controller_ != nullptr) {
ad_controller_->BrightnessChangedManually();
}

Expand Down

0 comments on commit 19f70b5

Please sign in to comment.