尝试修复编队和角色装备界面报错的问题

dev_chengFeng
gaoxin 2020-07-31 18:24:13 +08:00
parent a4bcead414
commit 4c93923b39
2 changed files with 9 additions and 3 deletions

View File

@ -129,8 +129,11 @@ function this.GetAllFormationHeroId()
local index = 1
for i, team in pairs(this.formationList) do
for j = 1, #team.teamHeroInfos do
list[team.teamHeroInfos[j].heroId] = index
index = index + 1
-- 加空判断避免不知名错误
if team and team.teamHeroInfos[j] then
list[team.teamHeroInfos[j].heroId] = index
index = index + 1
end
end
end
return list

View File

@ -277,7 +277,10 @@ function this.RefreshFormation()
this.choosedList ={}
for j = 1, #curFormation.teamHeroInfos do
local teamInfo = curFormation.teamHeroInfos[j]
table.insert(this.choosedList, {heroId =teamInfo.heroId,position=teamInfo.position})
-- 加空判断避免不知名错误
if teamInfo then
table.insert(this.choosedList, {heroId =teamInfo.heroId,position=teamInfo.position})
end
end
this.order = #this.choosedList