]> source.dussan.org Git - poi.git/commitdiff
workaround for NPE caused by old Word format
authorSergey Vladimirov <sergey@apache.org>
Mon, 4 Jul 2011 19:03:45 +0000 (19:03 +0000)
committerSergey Vladimirov <sergey@apache.org>
Mon, 4 Jul 2011 19:03:45 +0000 (19:03 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142760 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java

index b7c4db7e9976b8a63cc5edc095e53574f8aefb98..940f20438fe45754e0f51de7b04fcce2906dab3a 100644 (file)
@@ -57,11 +57,17 @@ public final class CHPX extends BytePropertyNode
 
   public CharacterProperties getCharacterProperties(StyleSheet ss, short istd)
   {
-    CharacterProperties baseStyle = ss.getCharacterStyle(istd);
+    CharacterProperties baseStyle;
+    if (ss == null) {
+      //old document format
+      baseStyle = new CharacterProperties();
+    } else {
+      baseStyle = ss.getCharacterStyle(istd);
+    }
     CharacterProperties props = CharacterSprmUncompressor.uncompressCHP(baseStyle, getGrpprl(), 0);
     return props;
   }
-  
+
   public String toString() {
       return "CHPX from " + getStart() + " to " + getEnd() + 
          " (in bytes " + getStartBytes() + " to " + getEndBytes() + ")";