]> source.dussan.org Git - poi.git/commitdiff
small fic to prevent NPE when iterating over shape attributes in HSLF
authorYegor Kozlov <yegor@apache.org>
Sun, 11 Mar 2012 07:14:16 +0000 (07:14 +0000)
committerYegor Kozlov <yegor@apache.org>
Sun, 11 Mar 2012 07:14:16 +0000 (07:14 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1299336 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/model/Shape.java

index 88c0b19fddfeff5ca70583d0a08eb32cb1c78e0d..ef4c4c8a60461bb661f293ed61c879f9a9f64612 100644 (file)
@@ -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;