diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java b/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java index c3e66f6e7..2d10335c9 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/StyleSheet.java @@ -321,11 +321,22 @@ public final class StyleSheet implements HDFType { public ParagraphProperties getParagraphStyle(int x) { - if (x == NIL_STYLE) - { + if (x == NIL_STYLE) { + return NIL_PAP; + } + + if (x >= _styleDescriptions.length) { return NIL_PAP; } - return (_styleDescriptions[x] != null ? _styleDescriptions[x].getPAP() : null); - } + if (_styleDescriptions[x]==null) { + return NIL_PAP; + } + + if (_styleDescriptions[x].getPAP()==null) { + return NIL_PAP; + } + + return _styleDescriptions[x].getPAP(); + } }