Skip to content

Commit 8055524

Browse files
committed
Changes to comply with review comments
1 parent a722d45 commit 8055524

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

pypdf/_writer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
Fit,
100100
FloatObject,
101101
IndirectObject,
102-
NamedReferenceLink,
103102
NameObject,
104103
NullObject,
105104
NumberObject,

pypdf/generic/_link.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
# POSSIBILITY OF SUCH DAMAGE.
2626

2727

28-
# This module contains classes used by _writer.py to track links in
29-
# pages being added to the writer until the links can be resolved.
28+
# This module contains code used by _writer.py to track links in pages
29+
# being added to the writer until the links can be resolved.
3030

3131
from typing import TYPE_CHECKING, List, Optional, Tuple, Union, cast
3232

@@ -48,7 +48,7 @@ def __init__(self, reference: TextStringObject, source_pdf: "PdfReader") -> None
4848

4949
def find_referenced_page(self) -> Union[IndirectObject, None]:
5050
destination = self._source_pdf.named_destinations.get(str(self._reference))
51-
return destination.page if destinatino else None
51+
return destination.page if destinatinon else None
5252

5353
def patch_reference(self, target_pdf: "PdfWriter", new_page: IndirectObject) -> None:
5454
"""target_pdf: PdfWriter which the new link went into"""
@@ -92,7 +92,7 @@ def extract_links(new_page: "PageObject", old_page: "PageObject") -> List[Tuple[
9292
def _build_link(indirect_object: IndirectObject, page: "PageObject") -> Optional[ReferenceLink]:
9393
src = cast("PdfReader", page.pdf)
9494
link = cast(DictionaryObject, indirect_object.get_object())
95-
if link.get("/Subtype") != "/Link":
95+
if (not isinstance(link, DictionaryObject)) or link.get("/Subtype") != "/Link":
9696
return None
9797

9898
if "/A" in link:

0 commit comments

Comments
 (0)