-
-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LUA Error then... i dont know, it's random #427
Comments
a "simple" fix would be... in the file if line:GetText():find('^' .. COLLECTED) then with this one if line and line:GetText() ~= nil and line:GetText():find('^' .. COLLECTED) then but it is just an "imperfect" fix! a "proper" way would be to replace the whole function function Tooltips.OnUnit(tip)
if not tip or not TooltipUtil.GetDisplayedUnit then return end
local name = TooltipUtil.GetDisplayedUnit(tip)
if not name or not C_PetJournal.FindPetIDByName then return end
local specie = C_PetJournal.FindPetIDByName(name)
if not specie or not Addon.Specie then return end
local specieObj = Addon.Specie(specie)
if not specieObj or not specieObj.GetOwnedText then return end
local owned = specieObj:GetOwnedText()
if not owned or not tip.NumLines or not tip.GetName then return end
for i = 1, tip:NumLines() do
local lineName = tip:GetName() .. 'TextLeft' .. i
local line = lineName and _G[lineName]
if line and line.GetText and line.SetText then
local text = line:GetText()
if text and text:find('^' .. COLLECTED) then
line:SetText(DIM_GREEN_FONT_COLOR:WrapTextInColorCode(owned))
return
end
end
end
end to prevent ALL possible NIL errors... this also should be done with every function that "can" throw nil errors! function Tooltips.OnBattlePet(tip, data)
if not tip or not data or not data.speciesID then return end
local specie = Addon.Specie and Addon.Specie(data.speciesID)
local breed = Addon.Predict and Addon.Predict.Breed and Addon.Predict:Breed(
data.speciesID, data.level, (data.breedQuality or 0) + 1, data.maxHealth, data.power, data.speed
)
if not specie or not breed then return end
tip.specie = specie
tip.breed = breed
if not tip.Source then
if not tip.CreateFontString then return end
tip.Source = tip:CreateFontString(nil, 'ARTWORK', 'GameFontHighlightLeft')
tip.Source:SetPoint('BOTTOMLEFT', tip, 11, 8)
tip.Source:SetSize((tip.GetWidth and tip:GetWidth() or 0) - 20, 0)
hooksecurefunc(tip, 'Show', function(t)
if not t or not t.specie or not t.breed then return end
if t.Owned and t.Owned.SetText then
t.Owned:SetText(NORMAL_FONT_COLOR:WrapTextInColorCode(t.specie:GetOwnedText() or ''))
end
if t.Name and t.Name.SetText then
t.Name:SetText((t.Name:GetText() or '') .. Addon.Breeds:Icon(t.breed, .8, 5, 0))
end
if t.Source and t.Source.SetText then
t.Source:SetText(select(5, t.specie:GetInfo()) or '')
end
if t.SetHeight and t.GetHeight and t.Source.GetHeight then
t:SetHeight(t:GetHeight() + t.Source:GetHeight())
end
end)
end
end but it's up to you, just suggesting ^^ greetings |
I got the same error too
|
When hovering/targeting Father Winter's Helper, i.e. in Orgrimmar (the quick flight dude) EDIT: Random spider critter in raid nerub-ar palace |
LUA Error
The text was updated successfully, but these errors were encountered: