Issue description

So, the train here is supposed to be headed straight into the station. However, at some point between waiting in the stack and getting stuck like this, it has rerouted to a different station, to which it has no path. Moreover, the station right there, on the screenshot, is now reserved by the second train on the screenshot.
My opinion is that a train should check if it has available path to the station, before deciding that that is the station it wants to go to. This would also fix a problem where the station is getting build, and train already wants to go to it, even though it has no path, and gets stuck unable to choose another valid station.
Reproduction steps
I wish i knew how to reproduce this, but right now it seems to be happening randomly. I guess you could empty out the 2nd station (off screen) and that might trigger it.
Game version and build number
v0.7.9 b495
Operating system
Windows
Attachments
https://drive.google.com/file/d/1i1KJFd-O7pRtbPE_OoejckbCV607E7tx/view?usp=sharing
save file there, github doesn't let me upload properly