HonorSpy

HonorSpy

2M Downloads

Esitmation calculation has error when numeric field is nil

jesse-greathouse opened this issue ยท 1 comments

commented
-- parse message
-- COMBATLOG_HONORGAIN = "%s dies, honorable kill Rank: %s (Estimated Honor Points: %d)";
-- COMBATLOG_HONORAWARD = "You have been awarded %d honor points.";
local function parseHonorMessage(msg)
	local honor_gain_pattern = string.gsub(COMBATLOG_HONORGAIN, "%(", "%%(")
	honor_gain_pattern = string.gsub(honor_gain_pattern, "%)", "%%)")
	honor_gain_pattern = string.gsub(honor_gain_pattern, "(%%s)", "(.+)")
	honor_gain_pattern = string.gsub(honor_gain_pattern, "(%%d)", "(%%d+)")
    local victim, rank, est_honor = msg:match(honor_gain_pattern)
    if (victim) then
    	est_honor = math.max(0, math.floor(est_honor * (1-0.25*(HonorSpy.db.char.today_kills[victim]-1 or 0)) + 0.5))
    end

    local honor_award_pattern = string.gsub(COMBATLOG_HONORAWARD, "(%%d)", "(%%d+)")
    local awarded_honor = msg:match(honor_award_pattern)
    return victim, est_honor, awarded_honor
end

The error occurs in this line:

est_honor = math.max(0, math.floor(est_honor * (1-0.25*(HonorSpy.db.char.today_kills[victim]-1 or 0)) + 0.5))

The error dump:

Date: 2019-11-22 15:47:46
ID: 1
Error occured in: Global
Count: 3
Message: ..\AddOns\honorspy\honorspy.lua line 147:
attempt to perform arithmetic on field '?' (a nil value)
Debug:
(tail call): ?
honorspy\honorspy.lua:147:
honorspy\honorspy.lua:140
honorspy\honorspy.lua:156:
honorspy\honorspy.lua:155
[C]: ?
...sic\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:29:
...sic\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:25
...sic\Libs\CallbackHandler-1.0\CallbackHandler-1.0.lua:64: Fire()
...\common\Wildpants\libs\AceEvent-3.0\AceEvent-3.0.lua:120:
...\common\Wildpants\libs\AceEvent-3.0\AceEvent-3.0.lua:119
Locals:
None
AddOns:
Swatter, v8.2.6377 (SwimmingSeadragon)
AdvancedInterfaceOptions, v1.3.3
AtlasLootClassic, vv1.3.4
AtlasLootClassicData, vv1.3.4
AtlasLootClassicDungeonsAndRaids, vv1.3.4
AucAdvanced, v8.2.6430 (SwimmingSeadragon)
AucFilterBasic, v8.2.6364 (SwimmingSeadragon)
AucStatHistogram, v8.2.6366 (SwimmingSeadragon)
AucStatiLevel, v8.2.6370 (SwimmingSeadragon)
AucStatPurchased, v8.2.6367 (SwimmingSeadragon)
AucStatSimple, v8.2.6399 (SwimmingSeadragon)
AucStatStdDev, v8.2.6369 (SwimmingSeadragon)
AucUtilFixAH, v8.2.6371 (SwimmingSeadragon)
BagBrother, v
Bagnon, v8.2.16
Bartender4, v4.8.8
BeanCounter, v8.2.6434 (SwimmingSeadragon)
BigWigs, vv6-classic
BlueShamans, v
ChocolateBar, vv3.3.4
ClassicCastbars, vv1.1.5
ClassicCastbarsOptions, v
ClassicCodex, v1.2.3
ClassicLFG, v1.1.3
Coordinates, v2.1.0
DejaClassicStats, v1302r039
Details, v
DetailsTinyThreat, v
EnchantrixBarker, v8.2.6469 (SwimmingSeadragon)
GatherMate2, v1.45.5
GearMenu, vv1.1.0
honorspy, v1.4.7
Informant, v8.2.6374 (SwimmingSeadragon)
ItemRack, v
KuiMedia, v
KuiNameplates, v
KuiNameplatesCore, v
LetMeCast, v1.3
OmniCC, v8.2.5
Prat30, v3.7.36
Prat30Libraries, v
Questie, v5.2.3
RealMobHealth, v2.13
ShadowedUnitFrames, vv4.2-Classic-Beta7
SlideBar, v8.2.6375 (SwimmingSeadragon)
Stubby, v8.2.6376 (SwimmingSeadragon)
TinyTooltip, v8.2.1
TradeSkillMaster, vv4.8.20
TradeSkillMasterAppHelper, vv4.0.5
WeakAuras, v2.15.5
BlizRuntimeLib_enUS v1.13.2.11302
(ck=5f7)

commented

fixed in v1.4.9