17,101
edits
(getPetSidebar: Use infobox class) |
(getPetSidebar: Gracefully handle case where pet could not be found) |
||
Line 197: | Line 197: | ||
local name = (args.name ~= nil and args.name ~= '') and args.name or args[1] | local name = (args.name ~= nil and args.name ~= '') and args.name or args[1] | ||
local pet = p.getPet(name) | local pet = p.getPet(name) | ||
if pet == nil then | |||
return 'ERROR: Could not find pet with name ' .. (name or 'Unknown') | |||
end | |||
local effect = (args.effect ~= nil and args.effect ~= '') and args.effect or p._getPetEffect(pet) | local effect = (args.effect ~= nil and args.effect ~= '') and args.effect or p._getPetEffect(pet) | ||
local completionReq = (pet.ignoreCompletion ~= nil and pet.ignoreCompletion) and 'No' or 'Yes' | local completionReq = (pet.ignoreCompletion ~= nil and pet.ignoreCompletion) and 'No' or 'Yes' |