Skip to content

Commit

Permalink
Only attempt to load annotation from a valid indirect object for anno…
Browse files Browse the repository at this point in the history
…tation Popup entries. Fixes #91.
  • Loading branch information
Gunnsteinn Hall authored and Gunnsteinn Hall committed Aug 1, 2017
1 parent 944d6dd commit 30ffbe3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pdf/model/annotations.go
Original file line number Diff line number Diff line change
Expand Up @@ -938,18 +938,18 @@ func (r *PdfReader) newPdfAnnotationMarkupFromDict(d *PdfObjectDictionary) (*Pdf
if _, isNull := obj.(*PdfObjectNull); !isNull {
return nil, fmt.Errorf("Popup should point to an indirect object")
}
}
} else {
popupAnnotObj, err := r.newPdfAnnotationFromIndirectObject(indObj)
if err != nil {
return nil, err
}
popupAnnot, isPopupAnnot := popupAnnotObj.context.(*PdfAnnotationPopup)
if !isPopupAnnot {
return nil, fmt.Errorf("Popup not referring to a popup annotation!")
}

popupAnnotObj, err := r.newPdfAnnotationFromIndirectObject(indObj)
if err != nil {
return nil, err
annot.Popup = popupAnnot
}
popupAnnot, isPopupAnnot := popupAnnotObj.context.(*PdfAnnotationPopup)
if !isPopupAnnot {
return nil, fmt.Errorf("Popup not referring to a popup annotation!")
}

annot.Popup = popupAnnot
}

if obj := d.Get("CA"); obj != nil {
Expand Down

0 comments on commit 30ffbe3

Please sign in to comment.