PetTracker

PetTracker

12M Downloads

Error occurs when clicking on an uncollected pet on tracker sidebar (with potential fix)

ghostpets opened this issue ยท 1 comments

commented

Running Software (issues missing this information will be deleted):

  • Addon version: 8.3.8
  • Server patch: 8.3.0 (34220)

Have you read the changelog? (please don't waste our time)
Yes, I have read it.

Describe the bug
When clicking on an uncollected pet (in red text) on the tracker sidebar on the right, the pet journal opens but does not select or display that pet and an add-on error occurs. This happens whether using the default pet journal or an add-on pet journal such as Rematch or Pet Journal Enhanced.

To Reproduce
Steps to reproduce the behaviour:

  1. Open the pet journal.
  2. Ensure "Track Pets" is checked.
  3. (Optional) Click on "Filter" and ensure "Not Collected" is checked.
  4. (Optional) Close the pet journal.
  5. Travel to a zone where you have an uncollected pet (in red text on the tracker sidebar on the right). You may also cage or release a collected pet in that zone so it becomes uncollected and shows up in red text.
  6. Click on an uncollected pet in red text. The pet journal opens but does not select or display that pet and an add-on error occurs.

Expected behaviour
The pet journal opens and selects and/or displays the uncollected pet without error.

Screenshots
i.imgur.com/kbQt8Zw.jpg - the error
i.imgur.com/V7pDv2S.jpg - after code modification written below in "Potential Fix" section

Error Logs

Message: ...s\PetTracker\addons\main\classes\abstract\specie.lua:26: attempt to index a nil value
Time: Sun May 24 02:48:26 2020
Count: 1
Stack: ...s\PetTracker\addons\main\classes\abstract\specie.lua:26: attempt to index a nil value
[string "=[C]"]: ?
[string "@Interface\AddOns\PetTracker\addons\main\classes\abstract\specie.lua"]:26: in function `GetID'
[string "@Interface\AddOns\PetTracker\addons\main\classes\abstract\pet.lua"]:33: in function `Display'
[string "@Interface\AddOns\PetTracker\addons\main\classes\tracking\tracker.lua"]:76: in function <...\PetTracker\addons\main\classes\tracking\tracker.lua:76>

Locals: 

POTENTIAL FIX

Here is what I changed in the PetTracker add-on code to fix the error for me:

  1. Go to the C:\Program Files(x86)\World of Warcraft\_retail_\Interface\Addons\PetTracker\addons\main\classes\abstract folder.
  2. Open the pet.lua file in Notepad.
  3. Go to lines 33-37 to this block of code:
  if self:GetID() then
    PetJournal_SelectPet(PetJournal, self:GetID())
  elseif self:GetSpecie() then
    PetJournal_SelectSpecies(PetJournal, self:GetSpecie())
  end

Delete the above block of code and replace it with this block of code:

  local owned = self:GetOwned()
  if #owned > 0 then
    PetJournal_SelectPet(PetJournal, self:GetID())
  else
    PetJournal_SelectSpecies(PetJournal, self:GetSpecie())
  end
  1. Save file and exit.
commented

I have the same issue but fixed it otherwise. The error occurs because i don't "own" the pet. So the method GetBestOwned in pet.lua will return nil and it is therefor not possible to use GetID in sepcie.lua where we see the null pointe.

Here is how i fixed it:

In specie.lua change

function Specie:GetID()
    return self:GetBestOwned():GetID()
end 

to

function Specie:GetID()
	if self:GetBestOwned() then
    	      return self:GetBestOwned():GetID()
  	end
end