Mercurial > dive4elements > river
changeset 1578:df11c4c8c578
Avoid certain npes.
flys-client/trunk@3847 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 01 Feb 2012 08:51:30 +0000 |
parents | 322f2626fb5d |
children | 637481aeae43 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/client/ui/ThemePanel.java flys-client/src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java |
diffstat | 3 files changed, 25 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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:
--- 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; }
--- 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; }