Mercurial > hg > openttd
changeset 12110:ec2c917b3560 draft
(svn r16523) -Fix (rNewPool): Segfault when small ufos were heading for deleted vehicles.
author | frosch <frosch@openttd.org> |
---|---|
date | Sat, 06 Jun 2009 10:40:16 +0000 |
parents | f48988eda1a7 |
children | faa0b6550e1f |
files | src/disaster_cmd.cpp |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/disaster_cmd.cpp +++ b/src/disaster_cmd.cpp @@ -314,7 +314,7 @@ } else { /* Target a vehicle */ Vehicle *u_tmp = Vehicle::Get(v->dest_tile); - if (u_tmp->type != VEH_ROAD || !IsRoadVehFront(u_tmp)) { + if (u_tmp == NULL || u_tmp->type != VEH_ROAD || !IsRoadVehFront(u_tmp)) { delete v; return false; } @@ -402,7 +402,7 @@ if (v->current_order.GetDestination() == 2) { if (GB(v->tick_counter, 0, 2) == 0) { - Industry *i = Industry::Get(v->dest_tile); + Industry *i = Industry::Get(v->dest_tile); // Industry destructor calls ReleaseDisastersTargetingIndustry, so this is valid int x = TileX(i->xy) * TILE_SIZE; int y = TileY(i->xy) * TILE_SIZE; uint32 r = Random(); @@ -420,7 +420,7 @@ v->current_order.SetDestination(2); v->age = 0; - Industry *i = Industry::Get(v->dest_tile); + Industry *i = Industry::Get(v->dest_tile); // Industry destructor calls ReleaseDisastersTargetingIndustry, so this is valid DestructIndustry(i); SetDParam(0, i->town->index);