mirror of https://github.com/apache/poi.git
Bug 64667.xlsx prevent NPE loading styles table
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1880834 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
252a4eccc9
commit
ab2dc71a95
|
@ -239,7 +239,7 @@ public class StylesTable extends POIXMLDocumentPart implements Styles {
|
||||||
if(styleDxfs != null) dxfs.addAll(Arrays.asList(styleDxfs.getDxfArray()));
|
if(styleDxfs != null) dxfs.addAll(Arrays.asList(styleDxfs.getDxfArray()));
|
||||||
|
|
||||||
CTTableStyles ctTableStyles = styleSheet.getTableStyles();
|
CTTableStyles ctTableStyles = styleSheet.getTableStyles();
|
||||||
if (ctTableStyles != null) {
|
if (ctTableStyles != null && styleDxfs != null) {
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
for (CTTableStyle style : ctTableStyles.getTableStyleArray()) {
|
for (CTTableStyle style : ctTableStyles.getTableStyleArray()) {
|
||||||
tableStyles.put(style.getName(), new XSSFTableStyle(idx, styleDxfs, style, indexedColors));
|
tableStyles.put(style.getName(), new XSSFTableStyle(idx, styleDxfs, style, indexedColors));
|
||||||
|
|
|
@ -3560,4 +3560,12 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||||
Assert.assertEquals("", aCell.getStringCellValue());
|
Assert.assertEquals("", aCell.getStringCellValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testBug64667() throws IOException {
|
||||||
|
//test that an NPE isn't thrown on opening
|
||||||
|
try (Workbook wb = XSSFTestDataSamples.openSampleWorkbook("64667.xlsx")) {
|
||||||
|
int activeSheet = wb.getActiveSheetIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue