HonorSpy

HonorSpy

2M Downloads

Error on opening addon from minimap

Dolu89 opened this issue ยท 1 comments

commented

Hello
I have installed this addon for the first time today and I got this error on trying to open it from minimap icon

Date: 2020-07-27 18:18:55
ID: 1
Error occured in: Global
Count: 1
Message: ..\AddOns\honorspy\honorspy.lua line 316:
   attempt to index field '?' (a nil value)
Debug:
   honorspy\honorspy.lua:316: Estimate()
   honorspy\GUI.lua:56: Show()
   honorspy\GUI.lua:88: Toggle()
   honorspy\honorspy.lua:626: OnClick()
   ...tlasLootClassic\Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua:144:
      ...tlasLootClassic\Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua:142
commented

This would prevent this error on Reset days and when someone purges their own data...

if t[brk[bracket]] and t[brk[bracket]][3] and t[brk[bracket]][4] then
	local btm_break_point_honor = math.max(t[brk[bracket]][3], tonumber(t[brk[bracket]][4]) or 0)
	local top_break_point_honor = 0
	if brk[bracket + 1] then -- do we even have next bracket?
		top_break_point_honor = math.max(t[brk[bracket + 1]][3], tonumber(t[brk[bracket + 1]][4]) or 0)
	else
		top_break_point_honor = math.max(t[1][3], tonumber(t[1][4]) or 0)
	end
	if curHonor == top_break_point_honor then
		inside_br_progress = 1
	else
		inside_br_progress = (curHonor - btm_break_point_honor)/(top_break_point_honor - btm_break_point_honor)
	end
end