Skip to content
Snippets Groups Projects
Commit 6805498a authored by Lene Wasskog's avatar Lene Wasskog
Browse files

fix: Add null check for observation data map

parent f32d24bd
No related branches found
No related tags found
1 merge request!191Add map module and Open-Meteo support
......@@ -69,13 +69,15 @@ public final class ExcelFileGenerator {
if (item.getObservationData() != null) {
Map<String, Object> observationDataMap = objectMapper.readValue(item.getObservationData(), HashMap.class);
pestSheetColIndex = COL_START_INDEX_DATA;
for (String key : dataColumnTitles.keySet()) {
Object value = observationDataMap.get(key);
if (value instanceof Number) {
row.createCell(pestSheetColIndex++).setCellValue(((Number) value).intValue());
} else {
row.createCell(pestSheetColIndex++).setCellValue(value != null ? value.toString() : "");
if (observationDataMap != null) {
pestSheetColIndex = COL_START_INDEX_DATA;
for (String key : dataColumnTitles.keySet()) {
Object value = observationDataMap.get(key);
if (value instanceof Number) {
row.createCell(pestSheetColIndex++).setCellValue(((Number) value).intValue());
} else {
row.createCell(pestSheetColIndex++).setCellValue(value != null ? value.toString() : "");
}
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment