Skip to content

Commit

Permalink
ROB : Cope with empty DecodeParams (py-pdf#1145 2nd part)
Browse files Browse the repository at this point in the history
  • Loading branch information
pubpub-zz committed Jul 24, 2022
1 parent db3439b commit 27b3f08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion PyPDF2/filters.py
Expand Up @@ -104,7 +104,7 @@ def decode(
predictor = decode_parm["/Predictor"]
else:
predictor = decode_parms.get("/Predictor", 1)
except AttributeError:
except (AttributeError, TypeError): # Type Error is NullObject
pass # Usually an array with a null object was read
# predictor 1 == no predictor
if predictor != 1:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_workflows.py
Expand Up @@ -151,6 +151,12 @@ def test_rotate_45():
(True, "https://arxiv.org/pdf/2201.00029.pdf", [0, 1, 6, 10]),
# #1145
(True, "https://github.com/py-pdf/PyPDF2/files/9174594/2017.pdf", [0]),
# #1145, remaining issue (empty arguments for FlateEncoding)
(
True,
"https://github.com/py-pdf/PyPDF2/files/9175966/2015._pb_decode_pg0.pdf",
[0],
),
# 6 instead of 5: as there is an issue in page 5 (missing objects)
# and too complex to handle the warning without hiding real regressions
(True, "https://arxiv.org/pdf/1601.03642.pdf", [0, 1, 5, 7]),
Expand Down

0 comments on commit 27b3f08

Please sign in to comment.