Skip to content
This repository has been archived by the owner on Dec 26, 2020. It is now read-only.

Better handle null embedded files #5

Open
bakersemail opened this issue Jun 9, 2020 · 1 comment
Open

Better handle null embedded files #5

bakersemail opened this issue Jun 9, 2020 · 1 comment
Assignees
Labels

Comments

@bakersemail
Copy link

bakersemail commented Jun 9, 2020

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

@righettod
Copy link
Owner

righettod commented Jun 9, 2020

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

@righettod righettod self-assigned this Jun 9, 2020
@righettod righettod added the bug label Jun 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants