From 6520b8050e9bc68e0b21c80a6db27e82a2362e3d Mon Sep 17 00:00:00 2001 From: Edward Firmo <94725493+edwardtfn@users.noreply.github.com> Date: Fri, 8 Aug 2025 14:02:40 +0200 Subject: [PATCH] Fixes "Dereference without null-check may crash on bad caller" --- .../TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml index fcad74a..566e30d 100644 --- a/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml +++ b/ESPHome/TX-Ultimate-Easy-ESPHome_core_hw_leds.yaml @@ -531,6 +531,14 @@ script: attr_global_ptr: uint32_t* then: - lambda: |- + if (!light_ptr) { + ESP_LOGE("${TAG_CORE_HW_LEDS}", "Invalid light pointer"); + return; + } + if (!attr_global_ptr) { + ESP_LOGE("${TAG_CORE_HW_LEDS}", "Invalid attributes pointer"); + return; + } tx_ultimate_easy::LightAttributes attrs = tx_ultimate_easy::unpack_light_attributes(*attr_global_ptr); auto call = light_ptr->make_call(); call.set_brightness(attrs.brightness / 100.0f); @@ -547,6 +555,14 @@ script: group_index: uint8_t # 1 or 2 then: - lambda: |- + if (!light_ptr) { + ESP_LOGE("${TAG_CORE_HW_LEDS}", "Invalid light pointer"); + return; + } + if (!attr_global_ptr) { + ESP_LOGE("${TAG_CORE_HW_LEDS}", "Invalid attributes pointer"); + return; + } auto attrs_pair = tx_ultimate_easy::unpack_dual_light_attributes(*attr_global_ptr); tx_ultimate_easy::LightAttributes attrs = (group_index == 1) ? attrs_pair.first : attrs_pair.second;