attempt to perform arithmetic on local 'itemLevel' (a nil value)
Ookami313 opened this issue ยท 7 comments
After the update to 9.0.2 I'm getting the following error when I log into the game. Thanks.
1x WQAchievements\WQAchievements-v9.0.1-4release.lua:2158: attempt to perform arithmetic on local 'itemLevel' (a nil value)
[string "@WQAchievements\WQAchievements-v9.0.1-4release.lua"]:2158: in function CheckItems' [string "@WQAchievements\WQAchievements-v9.0.1-4release.lua"]:1913: in function
Reward'
[string "@WQAchievements\WQAchievements-v9.0.1-4release.lua"]:447: in function <WQAchievements\WQAchievements.lua:413>
Locals:
self =
watched =
}
IsQuestFlaggedCompleted = defined @WQAchievements\WQAchievements.lua:3229
UpdateCustomRewards = defined @WQAchievements\Options.lua:1497
SetRewardLinkByID = defined @WQAchievements\WQAchievements.lua:2848
EnableModule = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:332
modules =
}
GetRewardForID = defined @WQAchievements\WQAchievements.lua:1581
IterateEmbeds = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:442
ToggleGet = defined @WQAchievements\Options.lua:1281
CreateCustomQuest = defined @WQAchievements\Options.lua:1368
debug = false
isQuestPinActive = defined @WQAchievements\WQAchievements.lua:3218
slash = defined @WQAchievements\WQAchievements.lua:467
SetDefaultModulePrototype = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:409
Show = defined @WQAchievements\WQAchievements.lua:1428
emissaryRewards = false
defaultModuleState = true
AnnouncePopUp = defined @WQAchievements\WQAchievements.lua:2708
IsEnabled = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:451
ExpansionList =
}
ScheduleTimer = defined @datastore\libs\AceTimer-3.0\AceTimer-3.0.lua:94
DisableModule = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:350
missionList =
}
CreateCustomMissionReward = defined @WQAchievements\Options.lua:1627
GetArgs = defined @datastore\libs\AceConsole-3.0\AceConsole-3.0.lua:144
data =
}
CreateGroup = defined @WQAchievements\Options.lua:1284
questList =
}
ZoneIDList =
}
start = 390925.180000
EmissaryReward = defined @WQAchievements\WQAchievements.lua:2947
questPinMapList =
}
AddRewardToMission = defined @WQAchievements\WQAchievements.lua:1340
CreateCustomReward = defined @WQAchievements\Options.lua:1486
SetEnabledState = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:424
IsTransmogable = defined @WQAchievements\WQAchievements.lua:1986
enabledState = true
link = defined @WQAchievements\WQAchievements.lua:1567
playerName = "Celandine-Cenarius"
rewards = false
questPinList =
}
links =
}
event = {
}
IterateModules = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:437
optionsFrame = {
}
faction = "Alliance"
db =
}
baseName = "WQAchievements"
SortOptions = defined @WQAchievements\Options.lua:1689
Reward = defined @WQAchievements\WQAchievements.lua:1842
CancelTimer = defined @datastore\libs\AceTimer-3.0\AceTimer-3.0.lua:147
CheckWQ = defined @WQAchievements\WQAchievements.lua:1439
AddToys = defined @WQAchievements\WQAchievements.lua:1285
AddMounts = defined @WQAchievements\WQAchievements.lua:1220
OnInitialize = defined @WQAchievements\WQAchievements.lua:276
NewModule = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:235
Disable = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:314
CreateQTip = defined @WQAchievements\WQAchievements.lua:2419
AddPets = defined @WQAchievements\WQAchievements.lua:1248
GetModule = defined @Inte
This appears to be happening on first login and seems like it is trying to get info before it is able, slotID is null as well. The problem is that prior to line 2158 there is no check to determine if itemLevel is null or not. Simply adding an if statement just prior to the usage seems to resolve it, from line 2157 in WQAchievements.lua:
local itemLevelEquipped = math.min(itemLevel1 or 1000, itemLevel2 or 1000)
if itemLevel then
if itemLevel - itemLevelEquipped >= self.db.profile.options.reward.gear.itemLevelUpgradeMin then
local item = {itemLink = itemLink, itemLevelUpgrade = itemLevel - itemLevelEquipped}
self:AddRewardToQuest(questID, "ITEM", item, isEmissary)
end
end
end
-- Azerite Armor Cache
Thanks for the code changes, but it doesn't look like that resolved the issue as I'm still getting an error when logging in. Same basic itemLevel nil value error, but now affecting different lines of code.
5x WQAchievements\WQAchievements-v9.0.1-4release.lua:2177: attempt to perform arithmetic on local 'itemLevel' (a nil value)
[string "@WQAchievements\WQAchievements-v9.0.1-4release.lua"]:2177: in function CheckItems' [string "@WQAchievements\WQAchievements-v9.0.1-4release.lua"]:1913: in function
?'
[string "@datastore\libs\AceTimer-3.0\AceTimer-3.0-17.lua"]:55: in function <DataStore\libs\AceTimer-3.0\AceTimer-3.0.lua:50>
Locals:
self =
watched =
}
IsQuestFlaggedCompleted = defined @WQAchievements\WQAchievements.lua:3231
UpdateCustomRewards = defined @WQAchievements\Options.lua:1497
SetRewardLinkByID = defined @WQAchievements\WQAchievements.lua:2850
EnableModule = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:332
modules =
}
GetRewardForID = defined @WQAchievements\WQAchievements.lua:1581
IterateEmbeds = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:442
ToggleGet = defined @WQAchievements\Options.lua:1281
CreateCustomQuest = defined @WQAchievements\Options.lua:1368
debug = false
isQuestPinActive = defined @WQAchievements\WQAchievements.lua:3220
slash = defined @WQAchievements\WQAchievements.lua:467
SetDefaultModulePrototype = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:409
Show = defined @WQAchievements\WQAchievements.lua:1428
emissaryRewards = true
defaultModuleState = true
AnnouncePopUp = defined @WQAchievements\WQAchievements.lua:2710
IsEnabled = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:451
ExpansionList =
}
ScheduleTimer = defined @datastore\libs\AceTimer-3.0\AceTimer-3.0.lua:94
DisableModule = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:350
missionList =
}
CreateCustomMissionReward = defined @WQAchievements\Options.lua:1627
GetArgs = defined @datastore\libs\AceConsole-3.0\AceConsole-3.0.lua:144
data =
}
CreateGroup = defined @WQAchievements\Options.lua:1284
questList =
}
ZoneIDList =
}
start = 6113.999000
EmissaryReward = defined @WQAchievements\WQAchievements.lua:2949
questPinMapList =
}
AddRewardToMission = defined @WQAchievements\WQAchievements.lua:1340
CreateCustomReward = defined @WQAchievements\Options.lua:1486
SetEnabledState = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:424
IsTransmogable = defined @WQAchievements\WQAchievements.lua:1986
enabledState = true
link = defined @WQAchievements\WQAchievements.lua:1567
playerName = "Celandine-Cenarius"
rewards = false
questPinList =
}
links =
}
event = {
}
IterateModules = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:437
optionsFrame = {
}
faction = "Alliance"
db =
}
baseName = "WQAchievements"
SortOptions = defined @WQAchievements\Options.lua:1689
Reward = defined @WQAchievements\WQAchievements.lua:1842
CancelTimer = defined @datastore\libs\AceTimer-3.0\AceTimer-3.0.lua:147
CheckWQ = defined @WQAchievements\WQAchievements.lua:1439
AddToys = defined @WQAchievements\WQAchievements.lua:1285
AddMounts = defined @WQAchievements\WQAchievements.lua:1220
OnInitialize = defined @WQAchievements\WQAchievements.lua:276
NewModule = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:235
Disable = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:314
CreateQTip = defined @WQAchievements\WQAchievements.lua:2421
AddPets = defined @WQAchievements\WQAchievements.lua:1248
GetModule = defined @interfa
Same basic thing, on line 2177 itemLevel is used, on the line just prior to that you should see:
if itemLevel1 then
simply change that to:
if itemLevel1 and itemLevel then
That looks to have fixed the issue, at least there is no error when logging in. Thanks for the help.
After performing the two changes mentioned, I get "\WQAchievements-v9.0.1-4release.lua:2278: attempt to perform arithmetic on local 'itemLevel' (a nil value)", which is the same thing only at a different line.
Why is itemLevel a nil value? It looks like it comes from "itemLevel = GetDetailedItemLevelInfo(itemLink)". Did something change with GetDetailedItemLevelInfo?
As listed by Angryaboutelves. Not sure what changed, but for the last few days no errors were occurring. As of logging in today, I'm getting the same error.
1x WQAchievements\WQAchievements-v9.0.1-4release.lua:2278: attempt to perform arithmetic on local 'itemLevel' (a nil value)
[string "@WQAchievements\WQAchievements-v9.0.1-4release.lua"]:2278: in function CheckItems' [string "@WQAchievements\WQAchievements-v9.0.1-4release.lua"]:1913: in function
?'
[string "@datastore\libs\AceTimer-3.0\AceTimer-3.0-17.lua"]:55: in function <DataStore\libs\AceTimer-3.0\AceTimer-3.0.lua:50>
Locals:
self =
watched =
}
IsQuestFlaggedCompleted = defined @WQAchievements\WQAchievements.lua:3231
UpdateCustomRewards = defined @WQAchievements\Options.lua:1497
SetRewardLinkByID = defined @WQAchievements\WQAchievements.lua:2850
EnableModule = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:332
modules =
}
GetRewardForID = defined @WQAchievements\WQAchievements.lua:1581
IterateEmbeds = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:442
ToggleGet = defined @WQAchievements\Options.lua:1281
CreateCustomQuest = defined @WQAchievements\Options.lua:1368
debug = false
isQuestPinActive = defined @WQAchievements\WQAchievements.lua:3220
slash = defined @WQAchievements\WQAchievements.lua:467
SetDefaultModulePrototype = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:409
Show = defined @WQAchievements\WQAchievements.lua:1428
emissaryRewards = false
defaultModuleState = true
AnnouncePopUp = defined @WQAchievements\WQAchievements.lua:2710
IsEnabled = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:451
ExpansionList =
}
ScheduleTimer = defined @datastore\libs\AceTimer-3.0\AceTimer-3.0.lua:94
DisableModule = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:350
missionList =
}
CreateCustomMissionReward = defined @WQAchievements\Options.lua:1627
GetArgs = defined @datastore\libs\AceConsole-3.0\AceConsole-3.0.lua:144
data =
}
CreateGroup = defined @WQAchievements\Options.lua:1284
questList =
}
ZoneIDList =
}
start = 170467.020000
EmissaryReward = defined @WQAchievements\WQAchievements.lua:2949
questPinMapList =
}
AddRewardToMission = defined @WQAchievements\WQAchievements.lua:1340
CreateCustomReward = defined @WQAchievements\Options.lua:1486
SetEnabledState = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:424
IsTransmogable = defined @WQAchievements\WQAchievements.lua:1986
enabledState = true
link = defined @WQAchievements\WQAchievements.lua:1567
playerName = "Celandine-Cenarius"
rewards = false
questPinList =
}
links =
}
event = {
}
IterateModules = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:437
optionsFrame = {
}
faction = "Alliance"
db =
}
baseName = "WQAchievements"
SortOptions = defined @WQAchievements\Options.lua:1689
Reward = defined @WQAchievements\WQAchievements.lua:1842
CancelTimer = defined @datastore\libs\AceTimer-3.0\AceTimer-3.0.lua:147
CheckWQ = defined @WQAchievements\WQAchievements.lua:1439
AddToys = defined @WQAchievements\WQAchievements.lua:1285
AddMounts = defined @WQAchievements\WQAchievements.lua:1220
OnInitialize = defined @WQAchievements\WQAchievements.lua:276
NewModule = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:235
Disable = defined @datastore\libs\AceAddon-3.0\AceAddon-3.0.lua:314
CreateQTip = defined @WQAchievements\WQAchievements.lua:2421
AddPets = defined @WQAchievements\WQAchievements.lua:1248
GetModule = defined @Inte
Before the itemLevel stuff that throws the error I check if itemLink exists.
I noticed that sometimes the itemLink exists, but it's an empty one.
GetDetailedItemLevelInfo returns nothing if the input isn't a proper itemlink, therefore itemLevel is nil and we get the error.
I couldn't test this well, because I couldn't reliably recreate the error.
Let me know if you still get this error.