changeset 713:d8e421d9d7ec

Fixed possible NPE.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 27 Jul 2015 12:57:12 +0200
parents f02862b1862d
children 1d05fc809fb4
files src/main/java/de/intevation/lada/factory/ProbeFactory.java
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/factory/ProbeFactory.java	Wed Jul 22 16:03:33 2015 +0200
+++ b/src/main/java/de/intevation/lada/factory/ProbeFactory.java	Mon Jul 27 12:57:12 2015 +0200
@@ -346,11 +346,11 @@
      * @return The updated probe object.
      */
     public LProbe findMediaDesk(LProbe probe) {
-        probe.setMedia(repository
-            .queryFromString("SELECT get_media_from_media_desk( :mediaDesk );", "stamm")
+        Object result = repository.queryFromString(
+                "SELECT get_media_from_media_desk( :mediaDesk );", "stamm")
             .setParameter("mediaDesk", probe.getMediaDesk())
-            .getSingleResult()
-            .toString());
+            .getSingleResult();
+        probe.setMedia(result != null ? result.toString() : "");
         return probe;
     }
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)