Skip to content

Commit

Permalink
Add nil guard to image read
Browse files Browse the repository at this point in the history
  • Loading branch information
CattenLinger committed Sep 29, 2024
1 parent 2e3fd05 commit cfaebf3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,19 @@ function testBadApple(screen, canvas)
canvas:clear()

for frame = 1, totalFrames do

local path = "../images/bad_apple/f" .. frame .. ".jpg"
local img = Image.loadFile("../images/bad_apple/f" .. frame .. ".jpg")
--local img = Image.loadFile("../images/daisuke/f" .. frame .. ".jpg")
if img == nil then
print("Expected image but got nil: "..path.."\n")
goto continue
end
canvas:drawImage(img, x, y, false)
screen:draw(canvas)
--io.write("frame[" .. frame .. "]\r")
--io.flush()
::continue::
end
end

Expand Down

0 comments on commit cfaebf3

Please sign in to comment.