Merge pull request #22 from rmroc451/1.6.1

Fix issue with cars that are missing tagcallouts from throwing errors.
This commit is contained in:
2024-07-13 11:12:24 -05:00
committed by GitHub

View File

@@ -70,7 +70,7 @@ internal class CarInspector_PopulateCarPanel_Patch
private static UIPanelBuilder AddCarConsistRebuildObservers(UIPanelBuilder builder, IEnumerable<Model.Car> consist) private static UIPanelBuilder AddCarConsistRebuildObservers(UIPanelBuilder builder, IEnumerable<Model.Car> consist)
{ {
TagController tagController = UnityEngine.Object.FindFirstObjectByType<TagController>(); TagController tagController = UnityEngine.Object.FindFirstObjectByType<TagController>();
foreach (Model.Car car in consist) foreach (Model.Car car in consist.Where(c => c.TagCallout != null))
{ {
builder = AddObserver(builder, car, PropertyChange.KeyForControl(PropertyChange.Control.Handbrake), tagController); builder = AddObserver(builder, car, PropertyChange.KeyForControl(PropertyChange.Control.Handbrake), tagController);
foreach (LogicalEnd logicalEnd in ends) foreach (LogicalEnd logicalEnd in ends)