changeset 7833:f97162606fa2 minfo-opt

Avoid NPE in sounding select state if no year is set for bed heights.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 03 Apr 2014 14:01:01 +0200
parents 1dbd4668e8ef
children b2a8a94a92f9
files artifacts/src/main/java/org/dive4elements/river/artifacts/states/SoundingsSelect.java
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/SoundingsSelect.java	Fri Mar 28 11:22:55 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/SoundingsSelect.java	Thu Apr 03 14:01:01 2014 +0200
@@ -122,10 +122,12 @@
                 String id    = PREFIX_SINGLE + s.getId();
                 String value = s.getDescription();
 
+                Integer year = s.getYear();
                 Element item = creator.create("item");
                 creator.addAttr(item, "label", value, true);
                 creator.addAttr(item, "value", id, true);
-                creator.addAttr(item, "year", s.getYear().toString());
+                creator.addAttr(item, "year",
+                    year != null ? s.getYear().toString() : "");
                 creator.addAttr(item, "type", s.getType().getName());
                 creator.addAttr(item, "range",
                     nf.format(s.getRange().getA()) +

http://dive4elements.wald.intevation.org