Bug 60574 prevent rare NPE in ListTables

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1778320 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tim Allison 2017-01-11 16:01:32 +00:00
parent cf37b13c3a
commit 7e74976c04
1 changed files with 13 additions and 0 deletions

View File

@ -135,9 +135,22 @@ public final class ListTables
return _plfLfo.getIlfoByLsid( lsid );
}
/**
* Get the ListLevel for a given lsid and level
* @param lsid
* @param level
* @return ListLevel if found, or <code>null</code> if ListData can't be found or if level is > that available
*/
public ListLevel getLevel(int lsid, int level)
{
ListData lst = _listMap.get(Integer.valueOf(lsid));
if (lst == null) {
if (log.check(POILogger.WARN)) {
log.log(POILogger.WARN, "ListData for " +
lsid + " was null.");
}
return null;
}
if(level < lst.numLevels()) {
ListLevel lvl = lst.getLevels()[level];
return lvl;