From 7e74976c04fb51724dff868585cecd63b3e9338b Mon Sep 17 00:00:00 2001 From: Tim Allison Date: Wed, 11 Jan 2017 16:01:32 +0000 Subject: [PATCH] Bug 60574 prevent rare NPE in ListTables git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1778320 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/org/apache/poi/hwpf/model/ListTables.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java b/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java index 01b9577421..d3865d25ce 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/ListTables.java @@ -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 null 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;