poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ser...@apache.org
Subject svn commit: r1142760 - /poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java
Date Mon, 04 Jul 2011 19:03:46 GMT
Author: sergey
Date: Mon Jul  4 19:03:45 2011
New Revision: 1142760

URL: http://svn.apache.org/viewvc?rev=1142760&view=rev
Log:
workaround for NPE caused by old Word format

Modified:
    poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java?rev=1142760&r1=1142759&r2=1142760&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java (original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java Mon Jul  4 19:03:45 2011
@@ -57,11 +57,17 @@ public final class CHPX extends ByteProp
 
   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() + ")";



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message