[Lada-commits] [PATCH 1 of 4] Fixed possible NPE

Wald Commits scm-commit at wald.intevation.org
Mon Jul 27 12:58:42 CEST 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1437994632 -7200
# Node ID d8e421d9d7ec3872006df14a6e990ef561f78039
# Parent  f02862b1862df0d2d6c6d6af89dbb4a551c97178
Fixed possible NPE.

diff -r f02862b1862d -r d8e421d9d7ec src/main/java/de/intevation/lada/factory/ProbeFactory.java
--- 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;
     }
 


More information about the Lada-commits mailing list