[bug-64508] add guard for invalid v value

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1879903 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2020-07-15 20:42:16 +00:00
parent 709a3eb32c
commit 20540f3c69
1 changed files with 7 additions and 4 deletions

View File

@ -374,10 +374,13 @@ public final class XSSFCell extends CellBase {
rt = new XSSFRichTextString(_cell.isSetV() ? _cell.getV() : ""); rt = new XSSFRichTextString(_cell.isSetV() ? _cell.getV() : "");
} else { } else {
if (_cell.isSetV()) { if (_cell.isSetV()) {
int idx = Integer.parseInt(_cell.getV()); try {
rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(idx)); int idx = Integer.parseInt(_cell.getV());
} rt = new XSSFRichTextString(_sharedStringSource.getEntryAt(idx));
else { } catch(Throwable t) {
rt = new XSSFRichTextString("");
}
} else {
rt = new XSSFRichTextString(""); rt = new XSSFRichTextString("");
} }
} }