Skip to content

Commit ce7646e

Browse files
author
bstorm
committed
fix the comment-remover loop
1 parent 8efb0b1 commit ce7646e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

adafruit_imageload/pnm/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ def load(f, header, *, bitmap=None, palette=None):
5454

5555
next_byte = f.read(1)
5656
if next_byte == b"#":
57-
if next_byte != b"\n":
58-
continue
57+
while True:
58+
f.read(1)
59+
if not next_byte:
60+
raise RuntimeError("Unsupported image format")
61+
if next_byte != b"\n":
62+
break
5963
if next_byte.isdigit():
6064
pnm_header.append(next_byte)
6165
continue

0 commit comments

Comments
 (0)