소스 검색

Bugly 服装升级防止报错

huangxiaoyue 1 년 전
부모
커밋
f80453c93f
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      GameClient/Assets/Game/HotUpdate/Views/ClothingSynthetic/ClothingSyntheticView.cs

+ 6 - 1
GameClient/Assets/Game/HotUpdate/Views/ClothingSynthetic/ClothingSyntheticView.cs

@@ -154,6 +154,11 @@ namespace GFGGame
             }
 
             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(_selectedItemId);
+            if (itemCfg == null) { 
+                ET.Log.Error("OnClickBtnProcuction itemCfg is null");
+                return;
+            }
+
             if (!ItemUtil.CheckItemEnough(itemCfg.syntheticCostID, itemCfg.syntheticCostNum))
             {
                 long has = ItemDataManager.GetItemNum(itemCfg.syntheticCostID);
@@ -165,7 +170,7 @@ namespace GFGGame
             for (int i = 0; i < materiarsOfSelectedItem.Count; i++)
             {
                 ItemData itemData = materiarsOfSelectedItem[i];
-                if (!ItemUtil.CheckItemEnough(materiarsOfSelectedItem[i].id, materiarsOfSelectedItem[i].num, true)) return;
+                if (itemData == null || !ItemUtil.CheckItemEnough(itemData.id, itemData.num, true)) return;
             }
             bool result = await ClothingSyntheticSProxy.ClothtingSynthetic(_selectedItemId);
             if (result)