]> source.dussan.org Git - poi.git/commitdiff
update paragraph rebuilding for case when empty papx [n; n) happens at the end of...
authorSergey Vladimirov <sergey@apache.org>
Tue, 23 Aug 2011 09:07:30 +0000 (09:07 +0000)
committerSergey Vladimirov <sergey@apache.org>
Tue, 23 Aug 2011 09:07:30 +0000 (09:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1160589 13f79535-47bb-0310-9956-ffa450edef68

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

index 1f79d4001a2bfb86d311047cc35d989afdefb475..69c0c061969c2e554140201d87f77519ef774c44 100644 (file)
@@ -208,10 +208,12 @@ public class PAPBinTable
             final int startInclusive = lastParStart;
             final int endExclusive = charIndex + 1;
 
+            boolean broken = false;
             List<PAPX> papxs = new LinkedList<PAPX>();
             for ( int papxIndex = lastPapxIndex; papxIndex < oldPapxSortedByEndPos
                     .size(); papxIndex++ )
             {
+                broken = false;
                 PAPX papx = oldPapxSortedByEndPos.get( papxIndex );
 
                 assert startInclusive == 0
@@ -221,11 +223,16 @@ public class PAPBinTable
                 if ( papx.getEnd() - 1 > charIndex )
                 {
                     lastPapxIndex = papxIndex;
+                    broken = true;
                     break;
                 }
 
                 papxs.add( papx );
             }
+            if ( !broken )
+            {
+                lastPapxIndex = oldPapxSortedByEndPos.size() - 1;
+            }
 
             if ( papxs.size() == 0 )
             {