Commits

Henning Brinkmann  committed 519c5ad

#b6986082# InsBoxen: Do not insert a new cell beyond the end

  • Participants
  • Parent commits 982381a

Comments (0)

Files changed (2)

File binfilter/bf_sw/source/core/docnode/sw_ndtbl.cxx

         SwEndNode* pEndNd = new SwEndNode( aEndIdx, *pSttNd );
 
         pPrvBox = new SwTableBox( pBoxFmt, *pSttNd, pLine );
-        pLine->GetTabBoxes().C40_INSERT( SwTableBox, pPrvBox, nInsPos + n );
+        
+        SwTableBoxes & rTabBoxes = pLine->GetTabBoxes();
+        USHORT nRealInsPos = nInsPos + n;        
+        if (nRealInsPos > rTabBoxes.Count())
+            nRealInsPos = rTabBoxes.Count();
+
+        rTabBoxes.C40_INSERT( SwTableBox, pPrvBox, nRealInsPos );
 
         if( NO_NUMBERING == pTxtColl->GetOutlineLevel()
  //FEATURE::CONDCOLL

File sw/source/core/docnode/ndtbl.cxx

 		new SwEndNode( aEndIdx, *pSttNd );
 
 		pPrvBox = new SwTableBox( pBoxFmt, *pSttNd, pLine );
-		pLine->GetTabBoxes().C40_INSERT( SwTableBox, pPrvBox, nInsPos + n );
+
+        SwTableBoxes & rTabBoxes = pLine->GetTabBoxes();
+        USHORT nRealInsPos = nInsPos + n;        
+        if (nRealInsPos > rTabBoxes.Count())
+            nRealInsPos = rTabBoxes.Count();
+
+        rTabBoxes.C40_INSERT( SwTableBox, pPrvBox, nRealInsPos );
 
 		//if( NO_NUMBERING == pTxtColl->GetOutlineLevel()//#outline level,zhaojianwei
 		if( ! pTxtColl->IsAssignedToListLevelOfOutlineStyle()//<-end,zhaojianwei