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:
parent
bf311b8e6e
commit
13499b6444
@ -135,9 +135,22 @@ public final class ListTables
|
|||||||
return _plfLfo.getIlfoByLsid( lsid );
|
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)
|
public ListLevel getLevel(int lsid, int level)
|
||||||
{
|
{
|
||||||
ListData lst = _listMap.get(Integer.valueOf(lsid));
|
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()) {
|
if(level < lst.numLevels()) {
|
||||||
ListLevel lvl = lst.getLevels()[level];
|
ListLevel lvl = lst.getLevels()[level];
|
||||||
return lvl;
|
return lvl;
|
||||||
|
Loading…
Reference in New Issue
Block a user