From 8eabd41edaea1ae7fb1891b52265c4ea7e8692b4 Mon Sep 17 00:00:00 2001 From: pubpub-zz <4083478+pubpub-zz@users.noreply.github.com> Date: Sun, 24 Jul 2022 16:31:26 +0200 Subject: [PATCH] ROB : Cope with empty DecodeParams (#1143 2nd part) --- PyPDF2/filters.py | 2 +- tests/test_workflows.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/PyPDF2/filters.py b/PyPDF2/filters.py index f23602db2..d27d09ac9 100644 --- a/PyPDF2/filters.py +++ b/PyPDF2/filters.py @@ -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: diff --git a/tests/test_workflows.py b/tests/test_workflows.py index 71e6a0240..9a9571dd7 100644 --- a/tests/test_workflows.py +++ b/tests/test_workflows.py @@ -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]),