Skip to content

Commit

Permalink
add nil checks to guard against nil reference errors under unexpected…
Browse files Browse the repository at this point in the history
… circumstances while investigating how those circumstances can manifest
  • Loading branch information
AlexFolland committed Jun 29, 2024
1 parent 3072359 commit 68fabed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion AutoGear.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4310,6 +4310,7 @@ function AutoGearIsGearPairEquippableTogether(a, b)
end

function AutoGearGetBestSetItems(info)
if not AutoGearBestItems then AutoGearUpdateBestItems() end
local setSlots = AutoGearGetSetSlots(info)
local bestSetScore = 0
local bestSet = {}
Expand All @@ -4319,6 +4320,9 @@ function AutoGearGetBestSetItems(info)
local thisIsABestItem
if setSlots then
for i,slot in ipairs(setSlots) do
if (not AutoGearBestItems) or (not AutoGearBestItems[slot]) or (AutoGearBestItems[slot].info and AutoGearBestItems[slot].info.empty) then
return bestSet, bestSetScore, 1, lowestBestItemScore
end
if AutoGearBestItems[slot].info and (
(
AutoGearBestItems[slot].info.link
Expand All @@ -4339,7 +4343,8 @@ function AutoGearGetBestSetItems(info)
) then
thisIsABestItem = 1
end
if AutoGearIsGearPairEquippableTogether(info, AutoGearBestItems[slot].info) then
if AutoGearBestItems[slot].info
and AutoGearIsGearPairEquippableTogether(info, AutoGearBestItems[slot].info) then
bestItem = AutoGearBestItems[slot]
if lowestBestItemScore == 0
or bestItem.score < lowestBestItemScore then
Expand Down

0 comments on commit 68fabed

Please sign in to comment.