https://issues.apache.org/bugzilla/show_bug.cgi?id=52662

             Bug #: 52662
           Summary: An incomplete fix for the NPE bug in CharacterRun.java
           Product: POI
           Version: unspecified
          Platform: PC
            Status: NEW
          Severity: critical
          Priority: P2
         Component: HWPF
        AssignedTo: dev@poi.apache.org
        ReportedBy: liangg...@sei.pku.edu.cn
    Classification: Unclassified


The fix revision 1142762 was aimed to remove an NPE bug on the returned value
of  "_doc.getFontTable() " in the method "toString" of the file
"/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/usermodel/CharacterRun.java"
, but it is incomplete. 
Since the "_doc.getFontTable()" could be null during the run-time execution,
its returned value should also be null-checked before being dereferenced in
other methods. 

The buggy code locations the same fix needs to be applied at are as bellows: 

Line 609 of the method "getSymbolFont". 


public Ffn getSymbolFont()
  {
    if (isSymbol()) {
[Line 609]      Ffn[] fontNames = _doc.getFontTable().getFontNames();

      if (fontNames.length <= _props.getFtcSym())
        return null;

      return fontNames[_props.getFtcSym()];
    } else
      throw new IllegalStateException("Not a symbol CharacterRun");
  }

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to