hwpf: ignore invalid style reference

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1065538 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Maxim Valyanskiy 2011-01-31 09:55:10 +00:00
parent 40dbadc49e
commit e325b96167

View File

@ -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();
}
}