]> source.dussan.org Git - poi.git/commitdiff
NPE check
authorSergey Vladimirov <sergey@apache.org>
Tue, 12 Jul 2011 00:37:45 +0000 (00:37 +0000)
committerSergey Vladimirov <sergey@apache.org>
Tue, 12 Jul 2011 00:37:45 +0000 (00:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1145405 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hwpf/usermodel/TableRow.java

index 16a2967bbbca749c694598509e67727d56a46d5f..0d861dac86e306de7e24459e4d4c5fc85562b606 100644 (file)
@@ -174,12 +174,15 @@ public final class TableRow extends Range
             cells.add( tableCell );
         }
 
-        TableCell lastCell = cells.get( cells.size() - 1 );
-        if ( lastCell.numParagraphs() == 1
-                && ( lastCell.getParagraph( 0 ).isTableRowEnd() ) )
+        if ( !cells.isEmpty() )
         {
-            // remove "fake" cell
-            cells.remove( cells.size() - 1 );
+            TableCell lastCell = cells.get( cells.size() - 1 );
+            if ( lastCell.numParagraphs() == 1
+                    && ( lastCell.getParagraph( 0 ).isTableRowEnd() ) )
+            {
+                // remove "fake" cell
+                cells.remove( cells.size() - 1 );
+            }
         }
 
         if ( cells.size() != expectedCellsCount )