# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller@intevation.de>
# Date 1328086290 0
# Node ID df11c4c8c5786b99e8a270ff3eeb511ff8095d7b
# Parent  322f2626fb5da009db89b566eb26edeb819ca780
Avoid certain npes.

flys-client/trunk@3847 c6561f87-3c4e-4783-a992-168aeb5c3f6f

diff -r 322f2626fb5d -r df11c4c8c578 flys-client/ChangeLog
--- a/flys-client/ChangeLog	Tue Jan 31 15:42:02 2012 +0000
+++ b/flys-client/ChangeLog	Wed Feb 01 08:51:30 2012 +0000
@@ -1,3 +1,9 @@
+2012-02-01  Felix Wolfsteller <felix.wolfsteller@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java,
+	  src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java:
+	  Avoid NPEs when a theme is null (which should not happen anyways).
+
 2012-01-31  Ingo Weinzierl <ingo@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/shared/model/IntegerRangeData.java:
diff -r 322f2626fb5d -r df11c4c8c578 flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Tue Jan 31 15:42:02 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java	Wed Feb 01 08:51:30 2012 +0000
@@ -235,11 +235,15 @@
         for (int i = 1; i <= count; i++) {
             Theme theme = themeList.getThemeAt(i);
 
-            if(theme.getFacet().equals("empty.facet")) {
+            if (theme == null) {
+                continue;
+            }
+
+            if (theme.getFacet().equals("empty.facet")) {
                 theme.setVisible(0);
             }
 
-            if (theme == null || theme.getVisible() == 0) {
+            if (theme.getVisible() == 0) {
                 continue;
             }
 
diff -r 322f2626fb5d -r df11c4c8c578 flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Tue Jan 31 15:42:02 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java	Wed Feb 01 08:51:30 2012 +0000
@@ -116,7 +116,13 @@
 
     /** Access data of collection item of theme. */
     public static String dataOf(Theme theme, String dataItemName) {
-        return theme.getCollectionItem().getData().get(dataItemName);
+        if (theme != null && theme.getCollectionItem() != null
+            && theme.getCollectionItem().getData() != null
+        ) {
+            return theme.getCollectionItem().getData().get(dataItemName);
+        }
+
+        return null;
     }
 
 
@@ -679,11 +685,15 @@
         for (int i = 1; i <= count; i++) {
             Theme theme = themeList.getThemeAt(i);
 
-            if(theme.getFacet().equals("empty.facet")) {
+            if (theme == null) {
+                continue;
+            }
+
+            if (theme.getFacet().equals("empty.facet")) {
                 theme.setVisible(0);
             }
 
-            if (theme == null || theme.getVisible() == 0) {
+            if (theme.getVisible() == 0) {
                 continue;
             }