Skip to content

Commit

Permalink
fix NRE in tank label when tank has no resource
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanKell authored Nov 15, 2023
1 parent dcee58b commit 11fc41a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/Tanks/TankWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void EnsureFreshAddLabelCache()
if (tank_module.AvailableVolume != oldAvailableVolume || tank_module.type != oldTankType){
foreach (FuelTank tank in tank_module.tanksDict.Values) {
double maxVol = tank_module.AvailableVolume * tank.utilization;
string maxVolStr = ResourceUnits.PrintAmount(maxVol, tank.resource.info.id);
string maxVolStr = tank.resource == null ? ResourceUnits.PrintSIAmount(maxVol, "L") : ResourceUnits.PrintAmount(maxVol, tank.resource.info.id);
string label = $"{Localizer.GetStringByTag("#RF_TankWindow_Max")}: " + maxVolStr + " (+" + ResourceUnits.PrintMass(tank_module.AvailableVolume * tank.mass) + " )"; // Max
addLabelCache[tank.name] = label;
}
Expand Down

0 comments on commit 11fc41a

Please sign in to comment.