mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-09 19:29:34 +08:00
Avoid crash if form is nil when filling
This commit is contained in:
parent
b39c7065e8
commit
ab87949919
@ -246,6 +246,9 @@ type FieldValueProvider interface {
|
||||
|
||||
// Fill populates `form` with values provided by `provider`.
|
||||
func (form *PdfAcroForm) Fill(provider FieldValueProvider) error {
|
||||
if form == nil {
|
||||
return nil
|
||||
}
|
||||
objMap, err := provider.FieldValues()
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -155,3 +155,8 @@ endobj
|
||||
t.Fatalf("Mismatch in expected and actual field dictionaries (deep)")
|
||||
}
|
||||
}
|
||||
|
||||
func TestFormNil(t *testing.T) {
|
||||
var form *PdfAcroForm
|
||||
form.Fill(nil)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user