Skip to content

Commit c8b6f4a

Browse files
LocalIdentityLocalIdentity
andauthored
Fix occasional crash when loading build on Beta branch (#7120)
We assume that something with the update luaJit is causing the issue when inserting new keys while iterating Fix done by Nostrademous Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 286a312 commit c8b6f4a

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

src/Modules/Data.lua

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -857,21 +857,33 @@ local function setupGem(gem, gemId)
857857
gem.naturalMaxLevel = gem.naturalMaxLevel or (#gem.grantedEffect.levels > 20 and #gem.grantedEffect.levels - 20) or (gem.grantedEffect.levels[3][1] and 3) or 1
858858
end
859859

860+
local toAddGems = { }
860861
for gemId, gem in pairs(data.gems) do
861-
gem.name = sanitiseText(gem.name)
862-
setupGem(gem, gemId)
863-
local loc, _ = gemId:find('Vaal')
864-
for _, alt in ipairs{"AltX", "AltY"} do
865-
if loc and data.skills[gem.secondaryGrantedEffectId..alt] then
866-
local newGem = copyTable(gem, true)
867-
newGem.name = "Vaal " .. data.skills[gem.secondaryGrantedEffectId..alt].name
868-
newGem.secondaryGrantedEffectId = gem.secondaryGrantedEffectId..alt
869-
newGem.variantId = gem.variantId..alt
870-
--ConPrintf("Adding Gem: " .. newGem.name .. "\t" .. newGem.secondaryGrantedEffectId)
871-
data.gems[gemId..alt] = newGem
872-
setupGem(newGem, gemId..alt)
873-
end
874-
end
862+
gem.name = sanitiseText(gem.name)
863+
setupGem(gem, gemId)
864+
local loc, _ = gemId:find('Vaal')
865+
for _, alt in ipairs{"AltX", "AltY"} do
866+
if loc and data.skills[gem.secondaryGrantedEffectId..alt] then
867+
local newGem = { name, gameId, variantId, grantedEffectId, secondaryGrantedEffectId, vaalGem, tags = {}, tagString, reqStr, reqDex, reqInt, naturalMaxLevel }
868+
newGem.name = "Vaal " .. data.skills[gem.secondaryGrantedEffectId..alt].name
869+
newGem.gameId = gem.gameId
870+
newGem.variantId = gem.variantId..alt
871+
newGem.grantedEffectId = gem.grantedEffectId
872+
newGem.secondaryGrantedEffectId = gem.secondaryGrantedEffectId..alt
873+
newGem.vaalGem = gem.vaalGem
874+
newGem.tags = copyTable(gem.tags)
875+
newGem.tagString = gem.tagString
876+
newGem.reqStr = gem.reqStr
877+
newGem.reqDex = gem.reqDex
878+
newGem.reqInt = gem.reqInt
879+
newGem.naturalMaxLevel = gem.naturalMaxLevel
880+
setupGem(newGem, gemId..alt)
881+
toAddGems[gemId..alt] = newGem
882+
end
883+
end
884+
end
885+
for id, gem in pairs(toAddGems) do
886+
data.gems[id] = gem
875887
end
876888

877889
-- Load minions

0 commit comments

Comments
 (0)