Skip to content

Commit

Permalink
Avoids crash when opening the TrainCarOperationsWebpage.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbm-OR committed Dec 7, 2023
1 parent 481ed9d commit 356b543
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -504,6 +504,7 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
{
var trainCarViewer = Owner.Viewer.TrainCarOperationsViewerWindow;
var carOperations = Owner.Viewer.CarOperationsWindow;
var trainCarWebpage = Owner.Viewer.TrainCarOperationsWebpage;

trainCarViewer.TrainCarOperationsChanged = !trainCarViewer.Visible && trainCarViewer.TrainCarOperationsChanged ? false : trainCarViewer.TrainCarOperationsChanged;

Expand Down Expand Up @@ -577,7 +578,7 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
carOperations.CarOperationChanged = carOperations.Visible && carOperations.CarOperationChanged;
}

if (CarPosition != trainCarViewer.CarPosition && Owner.Viewer.TrainCarOperationsWebpage.Connections > 0)
if (trainCarWebpage != null && CarPosition != trainCarViewer.CarPosition && trainCarWebpage.Connections > 0)
{
// Required to scroll the main window from the web version
UpdateTrainCarOperation = true;
Expand Down

0 comments on commit 356b543

Please sign in to comment.