diff --git a/Assets/Scripts/Common/ChatSystem/FireSiteInfo/ExternalForce/WaitingTruckItem.cs b/Assets/Scripts/Common/ChatSystem/FireSiteInfo/ExternalForce/WaitingTruckItem.cs index b7cecdf..40b9b41 100644 --- a/Assets/Scripts/Common/ChatSystem/FireSiteInfo/ExternalForce/WaitingTruckItem.cs +++ b/Assets/Scripts/Common/ChatSystem/FireSiteInfo/ExternalForce/WaitingTruckItem.cs @@ -18,18 +18,23 @@ public class WaitingTruckItem : MonoBehaviour { string amount = ""; if (info.MyCarMessage.WaterAmount != 0) { - //amount += "(载水量:" + info.MyCarMessage.WaterAmount.ToString() + ")"; - amount += "(可用水量:" + - (info.GetComponent().TotalWater - info.GetComponent().AllUserWater) + - " L)"; - + if (info.GetComponent()) + { + //amount += "(载水量:" + info.MyCarMessage.WaterAmount.ToString() + ")"; + amount += "(可用水量:" + + (info.GetComponent().TotalWater - info.GetComponent().AllUserWater) + + " L)"; + } } if(info.MyCarMessage.FoamAmount != 0) { - //amount += "(载泡沫量:" + info.MyCarMessage.FoamAmount.ToString() + ")"; - amount += "(可用泡沫量:" + - (info.GetComponent().TotalFoam - info.GetComponent().AllUserFoam) + - " L)"; + if (info.GetComponent()) + { + //amount += "(载泡沫量:" + info.MyCarMessage.FoamAmount.ToString() + ")"; + amount += "(可用泡沫量:" + + (info.GetComponent().TotalFoam - info.GetComponent().AllUserFoam) + + " L)"; + } } GetComponent().text = truckName + amount; }