poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From max...@apache.org
Subject svn commit: r1065538 - /poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java
Date Mon, 31 Jan 2011 09:55:10 GMT
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: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message