[ 
https://issues.apache.org/jira/browse/PDFBOX-4476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16780204#comment-16780204
 ] 

Derek Liu commented on PDFBOX-4476:
-----------------------------------

This code on screen shot is my changed result. The original code is:
{code}
    private List<COSDictionary> getKids(COSDictionary node)
    {
        List<COSDictionary> result = new ArrayList<>();

        COSArray kids = node.getCOSArray(COSName.KIDS);
        if (kids == null)
        {
            // probably a malformed PDF
            return result;
        }

        for (int i = 0, size = kids.size(); i < size; i++)
        {
            COSBase base = kids.getObject(i);
            if (base instanceof COSDictionary)
            {
                result.add((COSDictionary) base);
            }
            else
            {
                LOG.warn("COSDictionary expected, but got " + 
base.getClass().getSimpleName());
            }
        }

        return result;
    }
{code}

> Need handle the NullPointerException in PDPageTree
> --------------------------------------------------
>
>                 Key: PDFBOX-4476
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-4476
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Derek Liu
>            Priority: Major
>         Attachments: image-2019-02-28-13-24-27-954.png
>
>
> In class PDPageTree, the log will raise NPE error if "base" is null.
>  !image-2019-02-28-13-24-27-954.png! 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to