From 5b2ac3474dcac02c9ce4efe043de57d7056b70ae Mon Sep 17 00:00:00 2001 From: Adam Hellberg Date: Thu, 5 Dec 2024 11:43:55 +0100 Subject: [PATCH] Fix crash when confirming signal with "E" Would happen in certain circumstances when picking a new signal for a slot that has previously had a signal. Reported in: https://mods.factorio.com/mod/cybersyn-combinator/discussion/67515fb722fc1663076c8322 --- src/changelog.txt | 5 ++++- src/scripts/gui.lua | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/changelog.txt b/src/changelog.txt index 7c8109a..1346b2e 100644 --- a/src/changelog.txt +++ b/src/changelog.txt @@ -1,12 +1,15 @@ --------------------------------------------------------------------------------------------------- Version: 2.4.0 -Date: 2024-12-04 +Date: 2024-12-05 Major Features: - Support for logistic sections and groups. Features: - Show circuit network connection info in GUI. Optimizations: - Better detection of existing signals/sections when copy-pasting. + Bugfixes: + - Fix pressing confirm button (default "E") while signal picker dialog is open causing a crash + under certain circumstances. Gui: - Make UI more consistent with base game UI by only allowing left click on some UI elements. --------------------------------------------------------------------------------------------------- diff --git a/src/scripts/gui.lua b/src/scripts/gui.lua index f1dfeb8..c7f4273 100644 --- a/src/scripts/gui.lua +++ b/src/scripts/gui.lua @@ -735,6 +735,7 @@ local function confirm_signal_value(player_index, state, clear_selected) local slot_button = state.selected_slot_button if slot_button and slot_button.valid then slot_button.style = "flib_slot_button_default" end local current = state.combinator:get_item_slot(state.selected_section_index, state.selected_slot) + if not current.signal or not current.signal.name then return end local value = resolve_textfield_number(state.signal_value_items, player_index, current.count or 0) if not value then state.signal_value_confirm.enabled = false