From: Sergey Vladimirov Date: Mon, 4 Jul 2011 19:03:45 +0000 (+0000) Subject: workaround for NPE caused by old Word format X-Git-Tag: REL_3_8_BETA4~344 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6f98350f11fad1786db87647829c60817493417b;p=poi.git workaround for NPE caused by old Word format git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1142760 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java index b7c4db7e99..940f20438f 100644 --- a/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java +++ b/src/scratchpad/src/org/apache/poi/hwpf/model/CHPX.java @@ -57,11 +57,17 @@ public final class CHPX extends BytePropertyNode public CharacterProperties getCharacterProperties(StyleSheet ss, short istd) { - CharacterProperties baseStyle = ss.getCharacterStyle(istd); + CharacterProperties baseStyle; + if (ss == null) { + //old document format + baseStyle = new CharacterProperties(); + } else { + baseStyle = ss.getCharacterStyle(istd); + } CharacterProperties props = CharacterSprmUncompressor.uncompressCHP(baseStyle, getGrpprl(), 0); return props; } - + public String toString() { return "CHPX from " + getStart() + " to " + getEnd() + " (in bytes " + getStartBytes() + " to " + getEndBytes() + ")";