diff --git a/src/examples/src/org/apache/poi/hssf/usermodel/examples/ReadWriteWorkbook.java b/src/examples/src/org/apache/poi/hssf/usermodel/examples/ReadWriteWorkbook.java index f80afb95f..4080a4dc3 100644 --- a/src/examples/src/org/apache/poi/hssf/usermodel/examples/ReadWriteWorkbook.java +++ b/src/examples/src/org/apache/poi/hssf/usermodel/examples/ReadWriteWorkbook.java @@ -80,6 +80,8 @@ public class ReadWriteWorkbook HSSFWorkbook wb = new HSSFWorkbook(fs); HSSFSheet sheet = wb.getSheetAt(0); HSSFRow row = sheet.getRow(2); + if (row == null) + row = sheet.createRow(2); HSSFCell cell = row.getCell((short)3); if (cell == null) cell = row.createCell((short)3);