chronofanz / EnhancedDistrictServices

EnhancedDistrictServices mod for Cities Skylines, which allows more granular control of services and supply chains.
MIT License
8 stars 5 forks source link

NRE in TouristAI.GetVehicleInfo #59

Open originalfoo opened 4 years ago

originalfoo commented 4 years ago

Not sure if this is direct issue with EDS or maybe some conflict with another mod, however a user was getting NRE's in TouristAI.GetVehicleInfo and unsubbing EDS helped resolve the issue.

System.NullReferenceException: Object reference not set to an instance of an object
at TouristAI.GetVehicleInfo (uint16,CitizenInstance+,bool,VehicleInfo+) <0x003c7>
at TouristAI.StartPathFind (uint16,CitizenInstance+) <0x0052f>
at TouristAI.SetTarget (uint16,CitizenInstance+,uint16,bool) <0x00971>
at CitizenAI.SetTarget (uint16,CitizenInstance+,uint16) <0x0003e>
at OutsideConnectionAI.StartConnectionTransferImpl (uint16,Building+,TransferManager/TransferReason,TransferManager/TransferOffer,int,int,int) <0x02131>
at OutsideConnectionAI.StartConnectionTransfer (uint16,Building+,TransferManager/TransferReason,TransferManager/TransferOffer,int,int,int) <0x0008d>
at OutsideConnectionAI.StartTransfer (uint16,Building+,TransferManager/TransferReason,TransferManager/TransferOffer) <0x0004b>
at TransferManager.StartTransfer (TransferManager/TransferReason,TransferManager/TransferOffer,TransferManager/TransferOffer,int) <0x00643>
- at (wrapper dynamic-method) TransferManager.DMD<DMD<MatchOffers_Patch1>?-1208015744..MatchOffers_Patch1> (TransferManager,TransferManager/TransferReason) <0x0077c>
at TransferManager.SimulationStepImpl (int) <0x00070>
at SimulationManagerBase`2.SimulationStep (int) <0x0004c>
at TransferManager.ISimulationManager.SimulationStep (int) <0x00024>
at SimulationManager.LateUpdateData (SimulationManager/UpdateMode,single,single) <0x0017d>
at SimulationManager.Managers_LateUpdateData (SimulationManager/UpdateMode,single,single) <0x000c5>
at LoadingManager/<LoadSimulationData>c__IteratorB.MoveNext () <0x00b99>
at AsyncTask.Execute () <0x000a8>

This can happen if tourist is spawned but vehicle not assigned, for example. There are several other situations in which it can happen. In any case, it would be good to add some null checks or try..catch around this part of the code.

Full log: output_log(15).txt

CityGecko commented 3 years ago

To be prioritized