Changeset - r28666:fe8321658c2c
[Not reviewed]
master
0 1 0
Tyler Trahan - 10 months ago 2024-02-04 06:07:47
tyler@tylertrahan.com
Fix #11968: Always set string parameters to avoid undefined behavior (#11973)
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/order_gui.cpp
Show inline comments
 
@@ -1166,7 +1166,11 @@ public:
 
			case WID_O_DEPOT_ACTION: {
 
				VehicleOrderID sel = this->OrderGetSel();
 
				const Order *order = this->vehicle->GetOrder(sel);
 
				if (order == nullptr || !order->IsType(OT_GOTO_DEPOT)) break;
 
				if (order == nullptr || !order->IsType(OT_GOTO_DEPOT)) {
 
					/* We can't leave this param unset or the undefined behavior can cause a crash. */
 
					SetDParam(0, STR_EMPTY);
 
					break;
 
				};
 

	
 
				/* Select the current action selected in the dropdown. The flags don't match the dropdown so we can't just use an index. */
 
				if (order->GetDepotOrderType() & ODTFB_SERVICE) {
0 comments (0 inline, 0 general)