Changeset - r28355:6fb226bd4d6d
[Not reviewed]
master
0 1 0
Peter Nelson - 4 months ago 2023-12-30 13:29:31
peter1138@openttd.org
Fix #11649: Ignore disabling a widget that does not exist. (#11652)

Orders window has different widget layouts depending on vehicle type
which don't all have the same widgets, and therefore it tries to disable
widgets that might not exist.

Restore the old behaviour of ignoring such requests, instead of crashing.
1 file changed with 2 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/window_gui.h
Show inline comments
 
@@ -327,7 +327,8 @@ public:
 
	 */
 
	inline void SetWidgetDisabledState(WidgetID widget_index, bool disab_stat)
 
	{
 
		this->GetWidget<NWidgetCore>(widget_index)->SetDisabled(disab_stat);
 
		NWidgetCore *nwid = this->GetWidget<NWidgetCore>(widget_index);
 
		if (nwid != nullptr) nwid->SetDisabled(disab_stat);
 
	}
 

	
 
	/**
0 comments (0 inline, 0 general)