diff --git a/itext/itext.forms/itext/forms/PdfAcroForm.cs b/itext/itext.forms/itext/forms/PdfAcroForm.cs index b03714fc7a..e078dc80de 100644 --- a/itext/itext.forms/itext/forms/PdfAcroForm.cs +++ b/itext/itext.forms/itext/forms/PdfAcroForm.cs @@ -1034,6 +1034,9 @@ private IDictionary IterateFields(PdfArray array, IDiction String name; if (fieldName == null) { PdfFormField parentField = PdfFormField.MakeFormField(formField.GetParent(), document); + if (parentField == null){ + continue; + } while (fieldName == null) { fieldName = parentField.GetFieldName(); if (fieldName == null) { diff --git a/itext/itext.forms/itext/forms/fields/PdfFormField.cs b/itext/itext.forms/itext/forms/fields/PdfFormField.cs index bcde1363b4..aafd848a15 100644 --- a/itext/itext.forms/itext/forms/fields/PdfFormField.cs +++ b/itext/itext.forms/itext/forms/fields/PdfFormField.cs @@ -1646,7 +1646,7 @@ public static PdfChoiceFormField CreateList(PdfDocument doc, Rectangle rect, Str /// pdfObject does not contain a FT entry /// public static iText.Forms.Fields.PdfFormField MakeFormField(PdfObject pdfObject, PdfDocument document) { - if (pdfObject.IsDictionary()) { + if (pdfObject != null && pdfObject.IsDictionary()) { iText.Forms.Fields.PdfFormField field; PdfDictionary dictionary = (PdfDictionary)pdfObject; PdfName formType = dictionary.GetAsName(PdfName.FT);