document-upload-protection
document-upload-protection copied to clipboard
Better handle null embedded files
Found PDFs created by Xero threw a NPE. Needed to handle null EMBEDDEDFILES.
PdfDictionary names = root.getAsDict(PdfName.NAMES); PdfArray namesArray = null; if (names != null) { PdfDictionary embeddedFiles = names.getAsDict(PdfName.EMBEDDEDFILES); // Added this: need to check this isnt null if (embeddedFiles != null) { namesArray = embeddedFiles.getAsArray(PdfName.NAMES); } }
Thanks for the issue, do you have a sample file in order that I implements a unit test?