Skip to content

Commit

Permalink
fixed null pointer exception and shift 0
Browse files Browse the repository at this point in the history
Issue #165
  • Loading branch information
rsoika committed Nov 25, 2024
1 parent 333db24 commit ad4e598
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ public class POIUtil {
*/
public static void insertRows(XSSFSheet sheet, String cellReference, int numberOfRows) {

if (sheet == null || numberOfRows == 0 || cellReference == null || cellReference.isEmpty()) {
// no op
return;
}
CellReference refCell = new CellReference(cellReference);
XSSFRow refRow = sheet.getRow(refCell.getRow());

Expand Down Expand Up @@ -61,6 +65,11 @@ public static void insertRows(XSSFSheet sheet, String cellReference, int numberO
*/
public static void insertColumn(XSSFSheet sheet, int startColumn, int endColumn) {

if (sheet == null || endColumn == 0) {
// no op
return;
}

logger.fine("start Column=" + startColumn);

// // Find the last column by checking all rows
Expand Down

0 comments on commit ad4e598

Please sign in to comment.