Skip to content

Commit

Permalink
BUG: PdfReader.get_fields() attempts to delete non-existing index "/O…
Browse files Browse the repository at this point in the history
…ff" (#1933)
  • Loading branch information
dmjohnsson23 authored Jul 1, 2023
1 parent 014de9b commit 44790c4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pypdf/_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ def _build_field(
if s not in states:
states.append(s)
retval[key][NameObject("/_States_")] = ArrayObject(states)
if obj.get(FA.Ff, 0) & FA.FfBits.NoToggleToOff != 0:
if obj.get(FA.Ff, 0) & FA.FfBits.NoToggleToOff != 0 and "/Off" in retval[key]["/_States_"]:
del retval[key]["/_States_"][retval[key]["/_States_"].index("/Off")]

def _check_kids(
Expand Down

0 comments on commit 44790c4

Please sign in to comment.