Skip to content

Commit

Permalink
BUG: 'IndexError: index out of range' when using extract_text (#1361)
Browse files Browse the repository at this point in the history
Fixes #1358

Co-authored-by: diavral <73272031+diavral@users.noreply.github.com>
  • Loading branch information
MartinThoma and diavral authored Sep 24, 2022
1 parent 4ff5e0a commit dcab241
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion PyPDF2/generic/_data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ def __init__(
data = b""
for s in stream:
data += b_(s.get_object().get_data())
if data[-1] != b"\n":
if len(data) == 0 or data[-1] != b"\n":
data += b"\n"
stream_bytes = BytesIO(data)
else:
Expand Down

0 comments on commit dcab241

Please sign in to comment.