Skip to content
This repository has been archived by the owner on Feb 26, 2021. It is now read-only.

Commit

Permalink
Add catch for Pixelcanvas's ValueErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
DiamondIceNS committed Jun 10, 2018
1 parent b6a5793 commit 088387a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ config.json
*.sh

# Testing
test/
scratches/
5 changes: 4 additions & 1 deletion utils/render.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,10 @@ def __init__(self, x, y, data):
if not -1000000 <= bchk_tlp.x + cx < 1000000 or not -1000000 <= bchk_tlp.y + cy < 1000000:
bc.data.seek(2048, 1) # Skip out of bounds chunks
continue
img = Image.frombuffer('P', (64, 64), bc.data.read(2048), 'raw', 'P;4')
try:
img = Image.frombuffer('P', (64, 64), bc.data.read(2048), 'raw', 'P;4')
except ValueError:
raise checks.HttpPayloadError("pixelcanvas")
img.putpalette(palette_data)
fetched.paste(img, (bchk_off.x + cx, bchk_off.y + cy, bchk_off.x + cx + 64, bchk_off.y + cy + 64))

Expand Down

0 comments on commit 088387a

Please sign in to comment.