# HG changeset patch # User Tom Gottfried # Date 1375437068 -7200 # Node ID d3c6095813139032e6b2eb779771597a130bbb77 # Parent bd437771ea0039d681aafd04dcfde4dbcc3a73a6 Sediment Density parser: avoid NPE when no year is given diff -r bd437771ea00 -r d3c609581313 backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentDensityParser.java --- a/backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentDensityParser.java Fri Aug 02 11:36:33 2013 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentDensityParser.java Fri Aug 02 11:51:08 2013 +0200 @@ -177,12 +177,14 @@ } BigDecimal year = null; - try { - year = new BigDecimal(nf.parse(yearString).doubleValue()); - } - catch (ParseException pe) { - log.warn("Unparseable year string"); - } + if (yearString != null) { + try { + year = new BigDecimal(nf.parse(yearString).doubleValue()); + } + catch (ParseException pe) { + log.warn("Unparseable year string"); + } + } current.addValue(new ImportSedimentDensityValue( km,