From: Yegor Kozlov Date: Sun, 11 Mar 2012 07:14:16 +0000 (+0000) Subject: small fic to prevent NPE when iterating over shape attributes in HSLF X-Git-Tag: REL_3_8_FINAL~7 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8935e7eab222475f5a22df5938f6f25bbd9555c6;p=poi.git small fic to prevent NPE when iterating over shape attributes in HSLF git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1299336 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java b/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java index 88c0b19fdd..ef4c4c8a60 100644 --- a/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java +++ b/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java @@ -381,10 +381,11 @@ public abstract class Shape { boolean fSchemeIndex = (a & (1 << 3)) != 0; boolean fSysIndex = (a & (1 << 4)) != 0; - if (fSchemeIndex) + Sheet sheet = getSheet(); + if (fSchemeIndex && sheet != null) { //red is the index to the color scheme - ColorSchemeAtom ca = getSheet().getColorScheme(); + ColorSchemeAtom ca = sheet.getColorScheme(); int schemeColor = ca.getColor(r); r = (schemeColor >> 0) & 0xFF;