Skip to content

Commit 70a1325

Browse files
committed
Container weights: fix crashing bug
1 parent 563fe9d commit 70a1325

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Source/Orts.Simulation/Simulation/RollingStocks/MSTSWagon.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1976,7 +1976,10 @@ public override void Update(float elapsedClockSeconds)
19761976
}
19771977

19781978
// Updates the mass of the wagon considering all types of loads
1979-
if (FreightAnimations.WagonEmptyWeight != -1) MassKG = FreightAnimations.WagonEmptyWeight + FreightAnimations.FreightWeight + FreightAnimations.StaticFreightWeight + totalContainerMassKG;
1979+
if (FreightAnimations != null && FreightAnimations.WagonEmptyWeight != -1)
1980+
{
1981+
MassKG = FreightAnimations.WagonEmptyWeight + FreightAnimations.FreightWeight + FreightAnimations.StaticFreightWeight + totalContainerMassKG;
1982+
}
19801983
}
19811984
}
19821985

0 commit comments

Comments
 (0)