FS#71 - Invalid last_vehicle for station (crash)

Attached to Project: OpenTTD
Opened by jayson.barker (jayson.barker) - Sunday, 12 March 2006, 21:31 GMT
Last edited by Celestar (Celestar) - Tuesday, 28 March 2006, 15:48 GMT
Type Bug
Category Core
Status Closed
Assigned To Celestar (Celestar)
Operating System All
Severity Critical
Priority Urgent
Reported Version 0.4.5
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


This save game was saved from my openttd server, the server is running Fedora core 4, with openttd 0.4.5 running in dedicated server mode, all clients who connected to it crashed. I saved the game and opened it localy, and it still crashes. I have attached the savegame incase it is any use to you.

This task depends upon

This task blocks these from closing
 FS#83 - openttd crashes when joining network game 
Closed by  Celestar (Celestar)
Tuesday, 18 April 2006, 08:50 GMT
Reason for closing:  Fixed
Comment by Darkvater (Darkvater) - Tuesday, 14 March 2006, 07:38 GMT
On updating the station ratings the station's last vehicle is an invalid one (st->last_vehicle).
There is no functionality in the code for handling situations with a station where the last vehicle has been already deleted.

I propose not storing last_vehicle but only the last vehicle type to fix this problem. As far as I can see from the code, only GetVehicle(st->last_vehicle)->type is used.
Comment by Celestar (Celestar) - Thursday, 06 April 2006, 07:29 GMT
Here's a diff to solve the problem.