document-upload-protection icon indicating copy to clipboard operation
document-upload-protection copied to clipboard

Better handle null embedded files

Open bakersemail opened this issue 5 years ago • 1 comments

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); } }

bakersemail avatar Jun 09 '20 02:06 bakersemail

Thanks for the issue, do you have a sample file in order that I implements a unit test?

righettod avatar Jun 09 '20 09:06 righettod