Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/model/Wst.java @ 2794:3c26e16ae6c2
Fix or workaround flys/issue632, avoid NPE.
flys-backend/trunk@4112 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 02 Mar 2012 12:15:40 +0000 |
parents | ab1e642e7c85 |
children | c41bb1293acb |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/model/Wst.java Tue Feb 14 16:37:19 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Wst.java Fri Mar 02 12:15:40 2012 +0000 @@ -42,7 +42,7 @@ public static final String SQL_SELECT_MINMAX = "select min(q) as minQ, max(q) as maxQ from wst_q_values " + - "where wst_id = :wst and not (a > :km or b < :km)"; + "where wst_id = :wst and not (a > :km or b < :km)"; public Wst() { } @@ -197,12 +197,18 @@ List<Object[]> minmaxQ = sqlQuery.list(); + if (minmaxQ.isEmpty()) { return null; } Object[] mm = minmaxQ.get(0); + if (mm[0] == null || mm[1] == null) { + logger.warning ("No min/max Q for km " + km + " found."); + return null; + } + return new double[] { (Double) mm[0], (Double) mm[1] }; } }