Skip to content

Commit

Permalink
Fix crash when adding annotation, where :Annots can be a reference th…
Browse files Browse the repository at this point in the history
…at needs to be resolved
  • Loading branch information
ndbroadbent committed Jun 7, 2024
1 parent e8e5f14 commit d105471
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/pdf/core/annotations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ module Annotations
def annotate(options)
state.page.dictionary.data[:Annots] ||= []
options = sanitize_annotation_hash(options)
state.page.dictionary.data[:Annots] << ref!(options)
annots = state.page.dictionary.data[:Annots]
# Check if Annots is a reference that needs to be resolved
annots = annots.data if annots.is_a?(PDF::Core::Reference)
annots << ref!(options)
options
end

Expand Down

0 comments on commit d105471

Please sign in to comment.