Author: tallison
Date: Wed Jan 11 16:01:32 2017
New Revision: 1778320
URL: http://svn.apache.org/viewvc?rev=1778320&view=rev
Log:
Bug 60574 prevent rare NPE in ListTables
Modified:
poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
Modified: poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
URL:
http://svn.apache.org/viewvc/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java?rev=1778320&r1=1778319&r2=1778320&view=diff
==============================================================================
--- poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java
(original)
+++ poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java Wed
Jan 11 16:01:32 2017
@@ -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;
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]