Changeset - r15388:09ad3f13dbc1
[Not reviewed]
master
0 1 0
smatz - 14 years ago 2010-07-02 09:09:40
smatz@openttd.org
(svn r20041) -Fix [FS#3892](r19955): crash when spectator tried to open a vehicle list without selecting any company
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/vehicle_gui.cpp
Show inline comments
 
@@ -1272,14 +1272,18 @@ static WindowDesc _vehicle_list_desc(
 
	_nested_vehicle_list, lengthof(_nested_vehicle_list)
 
);
 

	
 
static void ShowVehicleListWindowLocal(CompanyID company, uint16 VLW_flag, VehicleType vehicle_type, uint16 unique_number)
 
{
 
	if (!Company::IsValidID(company)) {
 
		company = _local_company;
 
		/* This can happen when opening the vehicle list as a spectator.
 
		 * While it would be cleaner to check this somewhere else, having
 
		 * it here reduces code duplication */
 
		if (!Company::IsValidID(company)) return;
 
		_vehicle_list_desc.flags |= WDF_CONSTRUCTION;
 
		company = _local_company;
 
	} else {
 
		_vehicle_list_desc.flags &= ~WDF_CONSTRUCTION;
 
	}
 

	
 
	_vehicle_list_desc.cls = GetWindowClassForVehicleType(vehicle_type);
 
	WindowNumber num = (unique_number << 16) | (vehicle_type << 11) | VLW_flag | company;
0 comments (0 inline, 0 general)