mirror of
https://github.com/apache/poi.git
synced 2026-02-27 12:30:08 +08:00
Avoid NPE when retrieving sheets by name with invalid name
This commit is contained in:
parent
513a805c25
commit
04f4c1fa74
@ -1218,6 +1218,10 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
|
||||
*/
|
||||
@Override
|
||||
public XSSFSheet getSheet(String name) {
|
||||
if (name == null) {
|
||||
throw new IllegalArgumentException("Encountered an empty name when looking up sheets by name");
|
||||
}
|
||||
|
||||
for (XSSFSheet sheet : sheets) {
|
||||
if (name.equalsIgnoreCase(sheet.getSheetName())) {
|
||||
return sheet;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user