8000 Improve the error when gif file has too many colors · python-ugame/circuitpython-stage@b05e195 · GitHub
[go: up one dir, main page]

Skip to content

Commit b05e195

Browse files
committed
Improve the error when gif file has too many colors
1 parent 8d5cc38 commit b05e195

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,10 @@ def read_header(self):
317317
self.width, self.height, flags, self.background, self.aspect = (
318318
struct.unpack('<HHBBB', f.read(7)))
319319
self.palette_size = 1 << ((flags & 0x07) + 1)
320-
if not flags & 0x80 or self.palette_size > 16:
320+
if not flags & 0x80:
321321
raise NotImplementedError()
322+
if self.palette_size > 16:
323+
raise ValueError("Too many colors (%d/16)." % self.palette_size)
322324

323325
def read_palette(self):
324326
palette = array.array('H', (0 for i in range(16)))

0 commit comments

Comments
 (0)
0