Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4230

NullpointerException in CmapSubtable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0.9
    • 2.0.10, 3.0.0 PDFBox
    • FontBox
    • None

    Description

      I'm seeing a NullpointerException in CmapSubtable.java at line 601

      java.lang.NullPointerException at org.apache.fontbox.ttf.CmapSubtable.getGlyphId(CmapSubtable.java:601)

       

      The cause seems to be that the characterCodeToGlyphId is not initialised by all code paths.

       

      The suggested fix would be to simply initialise the variable on declaration (line 48)

      private Map<Integer, Integer> characterCodeToGlyphId = new HashMap<Integer, Integer>();

       

      Successfully tested this above suggested solution with a local build.
      Sorry, cannot share the PDF doc causing this.

      Attachments

        Activity

          People

            tilman Tilman Hausherr
            weissed Eduard
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: