processing AI trains raises redundant exception

Bug #1857997 reported by cjakeman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Open Rails
New
Undecided
cjakeman

Bug Description

The AITrain.AIUpdate() method sends signals to turn wipers on/off for AI trains depending on the rainfall.

If the first car in the train is not an MSTSLocomotive, then a NullReferenceException occurs which is then discarded with a:

catch {}

When developing, this fills the log with exception messages.
In production, it wastes CPU cycles.

I propose to replace the try {} catch {} with a check for != null

cjakeman (cjakeman)
Changed in or:
assignee: nobody → cjakeman (cjakeman)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.