Skip to content

Commit 835c520

Browse files
laniakea64niklasf
authored andcommitted
pgn: Skip over invalid or malformed headers
1 parent 865e467 commit 835c520

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

chess/pgn.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,9 @@ def read_game(handle: TextIO, *, Visitor: Any = GameBuilder) -> Any:
15381538
if unmanaged_headers is not None:
15391539
unmanaged_headers[tag_match.group(1)] = tag_match.group(2)
15401540
else:
1541-
break
1541+
# Ignore invalid or malformed headers.
1542+
line = handle.readline()
1543+
continue
15421544

15431545
line = handle.readline()
15441546

0 commit comments

Comments
 (0)