Browse Source

添加错误提示

guodong 2 years ago
parent
commit
e2631193a6
1 changed files with 6 additions and 0 deletions
  1. 6 0
      GameClient/Assets/Game/HotUpdate/Views/CommonGame/ItemView.cs

+ 6 - 0
GameClient/Assets/Game/HotUpdate/Views/CommonGame/ItemView.cs

@@ -1,3 +1,4 @@
+using ET;
 using FairyGUI;
 namespace GFGGame
 {
@@ -59,6 +60,11 @@ namespace GFGGame
         private void UpdateView()
         {
             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_itemData.id);
+            if(itemCfg == null)
+            {
+                Log.Error($"使用了一个不存在的物品 {_itemData.id}!");
+                return;
+            }
             _loaIcon.url = ResPathUtil.GetIconPath(itemCfg);
             RarityIconController.UpdateRarityIcon(_loaRarity, _itemData.id, false);
             // _imgGot.visible = false;