CLOSES #303, CLOSES #307, CLOSES #314, CLOSES #318

This commit is contained in:
bryanthaboi
2026-07-28 06:16:21 -04:00
parent 72f83760b7
commit 3b1032cc63
38 changed files with 1116 additions and 99 deletions
+5 -1
View File
@@ -37,7 +37,11 @@ function DexEntryMenu.new(game, speciesOrOpts)
self.def = game.data.pokemon[species]
local path = require("src.pokemon.Sprites").path(game.data, species, "front",
{ kind = "dex" })
local ok, img = path and pcall(love.graphics.newImage, path)
-- `path and pcall(...)` truncates to one value, so img was always nil and
-- every dex page drew without its pic (#307); the guard has to be a
-- statement for pcall's second return to survive.
local ok, img = false, nil
if path then ok, img = pcall(love.graphics.newImage, path) end
self.sprite = ok and img or nil
require("src.core.Sound").playCry(game.data, species)
return self