Author: maxcom
Date: Mon Jan 31 09:55:10 2011
New Revision: 1065538

URL: http://svn.apache.org/viewvc?rev=1065538&view=rev
Log:
hwpf: ignore invalid style reference

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

Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java?rev=1065538&r1=1065537&r2=1065538&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java 
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java Mon 
Jan 31 09:55:10 2011
@@ -321,11 +321,22 @@ public final class StyleSheet implements
 
   public ParagraphProperties getParagraphStyle(int x)
   {
-    if (x == NIL_STYLE)
-    {
+    if (x == NIL_STYLE) {
+        return NIL_PAP;
+    }
+
+    if (x >= _styleDescriptions.length) {
+      return NIL_PAP;
+    }
+
+    if (_styleDescriptions[x]==null) {
       return NIL_PAP;
     }
-    return (_styleDescriptions[x] != null ? _styleDescriptions[x].getPAP() : 
null);
-  }
 
+    if (_styleDescriptions[x].getPAP()==null) {
+      return NIL_PAP;
+    }
+
+    return _styleDescriptions[x].getPAP();
+  }
 }



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

Reply via email to