增加容错

This commit is contained in:
xiekaidong 2023-07-28 10:49:14 +08:00
parent 5a7249a545
commit 0fd125dcfc
2 changed files with 7 additions and 0 deletions

View File

@ -763,6 +763,9 @@ function UIPrefabObject:addRedPoint(offsetX, offsetY, scale, iconName, count, na
if not self.redPoint then if not self.redPoint then
if not self.loadRpOver then if not self.loadRpOver then
self.loadRpOver = true self.loadRpOver = true
if self:isDestroyed() or CS.BF.Utils.IsNull(self:getGameObject()) then
return
end
UIPrefabManager:loadUIWidgetAsync("assets/prefabs/ui/common/red_point_cell.prefab", self, function(prefabObject) UIPrefabManager:loadUIWidgetAsync("assets/prefabs/ui/common/red_point_cell.prefab", self, function(prefabObject)
self.redPoint = prefabObject self.redPoint = prefabObject
prefabObject:initPrefabHelper() prefabObject:initPrefabHelper()

View File

@ -95,6 +95,10 @@ function HeroCell:refreshRedPoint()
return return
end end
if not self.selfNode or self.selfNode:isDestroyed() or CS.BF.Utils.IsNull(self.selfNode:getGameObject()) then
return
end
if DataManager.FormationData:heroInFormation(GConst.BattleConst.FORMATION_TYPE.STAGE, self.heroEntity:getCfgId()) and DataManager.EquipData:canUpgradeEquip(self.heroEntity:getCfgId()) then if DataManager.FormationData:heroInFormation(GConst.BattleConst.FORMATION_TYPE.STAGE, self.heroEntity:getCfgId()) and DataManager.EquipData:canUpgradeEquip(self.heroEntity:getCfgId()) then
self.selfNode:addRedPoint(55, -35, 0.64) self.selfNode:addRedPoint(55, -35, 0.64)
else else