changeset 856:c3a5e1ee63b8

Avoid NPEs.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 02 Feb 2016 15:29:23 +0100 (2016-02-02)
parents 36b1104c3c22
children c481688150e8
files src/main/java/de/intevation/lada/query/QueryTools.java
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/query/QueryTools.java	Tue Feb 02 15:29:09 2016 +0100
+++ b/src/main/java/de/intevation/lada/query/QueryTools.java	Tue Feb 02 15:29:23 2016 +0100
@@ -211,6 +211,9 @@
             filters,
             params,
             repository.entityManager("land"));
+        if (q == null) {
+            return new ArrayList();
+        }
         return prepareResult(q.getResultList(), results);
     }
 
@@ -223,6 +226,9 @@
         javax.persistence.Query query = manager.createNativeQuery(sql);
         for (Filter filter: filters) {
             List<String> param = params.get(filter.getDataIndex());
+            if (param == null) {
+                return null;
+            }
             List<String> clean = new ArrayList<String>();
             for(String p : param) {
                 clean.add(p.replace(",", "|"));
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)