diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml index ea298f929..bb6643007 100644 --- a/src/documentation/content/xdocs/status.xml +++ b/src/documentation/content/xdocs/status.xml @@ -34,6 +34,7 @@ + 48846 - Avoid NPE when finding cell comments 49325 - Ensure that CTPhoneticPr is included in poi-ooxml jar 49191 - Fixed tests failing in non-english locales 48432 - Support for XSSF themes diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java b/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java index ac7ab6f91..a490d44df 100644 --- a/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java +++ b/src/java/org/apache/poi/hssf/usermodel/HSSFCell.java @@ -1079,12 +1079,16 @@ public class HSSFCell implements Cell { if (note.getRow() == row && note.getColumn() == column) { if(i < noteTxo.size()) { TextObjectRecord txo = noteTxo.get(note.getShapeId()); - comment = new HSSFComment(note, txo); - comment.setRow(note.getRow()); - comment.setColumn((short) note.getColumn()); - comment.setAuthor(note.getAuthor()); - comment.setVisible(note.getFlags() == NoteRecord.NOTE_VISIBLE); - comment.setString(txo.getStr()); + if(txo != null){ + comment = new HSSFComment(note, txo); + comment.setRow(note.getRow()); + comment.setColumn(note.getColumn()); + comment.setAuthor(note.getAuthor()); + comment.setVisible(note.getFlags() == NoteRecord.NOTE_VISIBLE); + comment.setString(txo.getStr()); + } else{ + log.log(POILogger.WARN, "Failed to match NoteRecord and TextObjectRecord, row: " + row + ", column: " + column); + } } else { log.log(POILogger.WARN, "Failed to match NoteRecord and TextObjectRecord, row: " + row + ", column: " + column); } diff --git a/test-data/spreadsheet/49325.xlsx b/test-data/spreadsheet/49325.xlsx new file mode 100755 index 000000000..adcba90b7 Binary files /dev/null and b/test-data/spreadsheet/49325.xlsx differ