diff --git a/Assets/ManagedResources/~Lua/Modules/Formation/FormationManager.lua b/Assets/ManagedResources/~Lua/Modules/Formation/FormationManager.lua index 47e5219977..8abf272991 100644 --- a/Assets/ManagedResources/~Lua/Modules/Formation/FormationManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Formation/FormationManager.lua @@ -421,11 +421,15 @@ end -- 获取所有正在编队的英雄id function this.AllFormationDeleCurHeroId(heroDid) for i, team in pairs(this.formationList) do + local removeIndex for j = 1, #team.teamHeroInfos do if team.teamHeroInfos[j] and team.teamHeroInfos[j].heroId == heroDid then - team.teamHeroInfos[j] = nil + removeIndex = j end end + if removeIndex then + table.remove( team.teamHeroInfos, removeIndex) + end end end diff --git a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua index 12f110dd3d..8ae3cc973e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Hero/HeroManager.lua @@ -650,7 +650,7 @@ function this.GetUpStarHeroListData(heroRankUpGroupId, heroData) for n, w in pairs(FormationManager.formationList) do if this.heroResolveLicence[n] then for m = 1, #w.teamHeroInfos do - if v.dynamicId == w.teamHeroInfos[m].heroId then + if w.teamHeroInfos[m] and v.dynamicId == w.teamHeroInfos[m].heroId then local isFormationStr = this.GetHeroFormationStr(n) v.isFormation = isFormationStr end