]> source.dussan.org Git - poi.git/commitdiff
hwpf: ignore incorrect ListFormatOverride reference that causes IndexOutOfBoundException
authorMaxim Valyanskiy <maxcom@apache.org>
Thu, 27 Jan 2011 12:42:12 +0000 (12:42 +0000)
committerMaxim Valyanskiy <maxcom@apache.org>
Thu, 27 Jan 2011 12:42:12 +0000 (12:42 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1064110 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
src/scratchpad/src/org/apache/poi/hwpf/usermodel/ListEntry.java

index 9124c1fb204faf0d462c690fdf5a340631c34484..b8529f55f03cf34f2bd73f71e9456d35771fcf4f 100644 (file)
@@ -165,6 +165,10 @@ public final class ListTables
     return _overrideList.get(lfoIndex - 1);
   }
 
+  public int getOverrideCount() {
+    return _overrideList.size();
+  }
+
   public int getOverrideIndexFromListID(int lstid)
   {
     int returnVal = -1;
index 6f29cf0d3cce20ce2c2644da5fd11f18e80b0afa..ba5bec75b5ee09248bd67eba0d07bbffbf1960fa 100644 (file)
@@ -37,7 +37,7 @@ public final class ListEntry
   {
     super(papx, parent);
 
-    if(tables != null) {
+    if(tables != null && _props.getIlfo() < tables.getOverrideCount()) {
            ListFormatOverride override = tables.getOverride(_props.getIlfo());
            _overrideLevel = override.getOverrideLevel(_props.getIlvl());
            _level = tables.getLevel(override.getLsid(), _props.getIlvl());