From 19f70b55354f1d8ce160504a611424b199de3a53 Mon Sep 17 00:00:00 2001 From: Markus Kirberg Date: Fri, 17 May 2024 07:23:33 +0200 Subject: [PATCH] light_bulb: fix possible crash --- src/shelly_hap_light_bulb.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shelly_hap_light_bulb.cpp b/src/shelly_hap_light_bulb.cpp index 921ee7d2..11095d5f 100644 --- a/src/shelly_hap_light_bulb.cpp +++ b/src/shelly_hap_light_bulb.cpp @@ -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(); } @@ -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(); }