diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java index f2595aff1..6f5b0cc6b 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFRow.java @@ -424,7 +424,7 @@ public class HSSFRow short cellnum = (short) (lastcell - 1); HSSFCell r = getCell(cellnum); - while (r == null) + while (r == null && cellnum >= 0) { r = getCell(--cellnum); }