Skip to content

Commit

Permalink
Merge pull request #8 from davidmc24/fix-nil-bug
Browse files Browse the repository at this point in the history
Fix nil arithmetic bug when pet is released mid-update
  • Loading branch information
GurliGebis authored Apr 7, 2024
2 parents be087df + 706f9b2 commit 9d46534
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions PetCard.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,15 @@ function module:UpdatePetCard()
local ownedElse = addon:ShortOwnedListOnly(PetJournalPetCard.speciesID, PetJournalPetCard.petID)
if ownedElse then
local _, _, _, _, rarity = C_PetJournal.GetPetStats(PetJournalPetCard.petID)
local color = ITEM_QUALITY_COLORS[rarity-1]

QualityFrame.quality:SetVertexColor(1, 1, 1)
QualityFrame.quality:SetText(format("%s%s|r (%s%s)",
color.hex,
_G["BATTLE_PET_BREED_QUALITY"..rarity],
L["ALSO_OWN_COLON"], ownedElse))
if rarity then
local color = ITEM_QUALITY_COLORS[rarity-1]

QualityFrame.quality:SetVertexColor(1, 1, 1)
QualityFrame.quality:SetText(format("%s%s|r (%s%s)",
color.hex,
_G["BATTLE_PET_BREED_QUALITY"..rarity],
L["ALSO_OWN_COLON"], ownedElse))
end
end
end
end

0 comments on commit 9d46534

Please sign in to comment.