From 9bbe827ab534cdbbb6e2687e0a41dda4b269d387 Mon Sep 17 00:00:00 2001 From: Joanne Shin Date: Thu, 14 Jul 2022 23:41:59 -0600 Subject: [PATCH] BUG: None-check in DictionaryObject.read_from_stream (#1113) Guard pdf.strict with check if pdf is None in DictionaryObject.read_from_stream Closes #1107 --- PyPDF2/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PyPDF2/generic.py b/PyPDF2/generic.py index e8a9d8d46..2c95a4a44 100644 --- a/PyPDF2/generic.py +++ b/PyPDF2/generic.py @@ -805,7 +805,7 @@ def read_unsized_from_steam(stream: StreamType, pdf: Any) -> bytes: # PdfReader f"Multiple definitions in dictionary at byte " f"{hex_str(stream.tell())} for key {key}" ) - if pdf.strict: + if pdf is not None and pdf.strict: raise PdfReadError(msg) else: warnings.warn(msg, PdfReadWarning)