Skip to content

Commit

Permalink
Check for NaN when receiving health data #129
Browse files Browse the repository at this point in the history
  • Loading branch information
funkydude committed Feb 4, 2023
1 parent e3afe29 commit 5905647
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Core.lua
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ do
if prefix == "Capping" and channel == "INSTANCE_CHAT" then
local strid, strhp = strsplit(":", msg)
local hp = tonumber(strhp)
if strid and hp and collection[strid] and hp <= 100 and hp >= 0 then
if strid and hp and collection[strid] and hp <= 100 and hp >= 0 and (hp < 0) ~= (hp >= 0) then -- Check hp is 0-100 and isn't NaN
if collection[strid].candyBarBar then
if hp < 100 then
reset[strid] = 0
Expand Down
2 changes: 1 addition & 1 deletion Core_BCC.lua
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ do
if prefix == "Capping" and channel == "INSTANCE_CHAT" then
local strid, strhp = strsplit(":", msg)
local hp = tonumber(strhp)
if strid and hp and collection[strid] and hp <= 100 and hp >= 0 then
if strid and hp and collection[strid] and hp <= 100 and hp >= 0 and (hp < 0) ~= (hp >= 0) then -- Check hp is 0-100 and isn't NaN
if collection[strid].candyBarBar then
if hp < 100 then
reset[strid] = 0
Expand Down
2 changes: 1 addition & 1 deletion Core_Vanilla.lua
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ do
if prefix == "Capping" and channel == "INSTANCE_CHAT" then
local strid, strhp = strsplit(":", msg)
local hp = tonumber(strhp)
if strid and hp and collection[strid] and hp <= 100 and hp >= 0 then
if strid and hp and collection[strid] and hp <= 100 and hp >= 0 and (hp < 0) ~= (hp >= 0) then -- Check hp is 0-100 and isn't NaN
if collection[strid].candyBarBar then
if hp < 100 then
reset[strid] = 0
Expand Down
2 changes: 1 addition & 1 deletion Core_Wrath.lua
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ do
if prefix == "Capping" and channel == "INSTANCE_CHAT" then
local strid, strhp = strsplit(":", msg)
local hp = tonumber(strhp)
if strid and hp and collection[strid] and hp <= 100 and hp >= 0 then
if strid and hp and collection[strid] and hp <= 100 and hp >= 0 and (hp < 0) ~= (hp >= 0) then -- Check hp is 0-100 and isn't NaN
if collection[strid].candyBarBar then
if hp < 100 then
reset[strid] = 0
Expand Down

0 comments on commit 5905647

Please sign in to comment.