]> source.dussan.org Git - poi.git/commitdiff
hwpf: ignore invalid style reference
authorMaxim Valyanskiy <maxcom@apache.org>
Thu, 21 Apr 2011 11:49:03 +0000 (11:49 +0000)
committerMaxim Valyanskiy <maxcom@apache.org>
Thu, 21 Apr 2011 11:49:03 +0000 (11:49 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1095664 13f79535-47bb-0310-9956-ffa450edef68

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

index 2d10335c9fb6f21878a6eb9af6b40dfc760b4ec6..5cbe03a881cf4a0b7c70d8722a246916da4c8410 100644 (file)
@@ -316,7 +316,12 @@ public final class StyleSheet implements HDFType {
     {
       return NIL_CHP;
     }
-    return (_styleDescriptions[x] != null ? _styleDescriptions[x].getCHP() : null);
+
+    if (x>=_styleDescriptions.length) {
+        return NIL_CHP;
+    }
+
+    return (_styleDescriptions[x] != null ? _styleDescriptions[x].getCHP() : NIL_CHP);
   }
 
   public ParagraphProperties getParagraphStyle(int x)