Skip to content

Commit 19f70b5

Browse files
author
Markus Kirberg
committed
light_bulb: fix possible crash
1 parent fb37c90 commit 19f70b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/shelly_hap_light_bulb.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ void LightBulb::SetColorTemperature(int color_temperature,
234234
source != kChangeReasonAuto) {
235235
color_temperature_characteristic->RaiseEvent();
236236
}
237-
if (source == kCHangeReasonHAP) {
237+
if (source == kCHangeReasonHAP && ad_controller_ != nullptr) {
238238
ad_controller_->ColorTempChangedManually();
239239
}
240240

@@ -267,7 +267,7 @@ void LightBulb::SetBrightness(int brightness, const std::string &source) {
267267
if (brightness_characteristic != nullptr) {
268268
brightness_characteristic->RaiseEvent();
269269
}
270-
if (source == kCHangeReasonHAP) {
270+
if (source == kCHangeReasonHAP && ad_controller_ != nullptr) {
271271
ad_controller_->BrightnessChangedManually();
272272
}
273273

0 commit comments

Comments
 (0)