From eb2c29966c7f58a3191c0b22ff9d337ce190c64a Mon Sep 17 00:00:00 2001 From: Arnau Sanchez Date: Thu, 12 Dec 2024 13:40:55 +0100 Subject: [PATCH] fix: check fileResource null reference --- .../shared/postprocess/EventFileResourcePostProcessor.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/importer/shared/postprocess/EventFileResourcePostProcessor.java b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/importer/shared/postprocess/EventFileResourcePostProcessor.java index f8345d0045b7..893d531b42d0 100644 --- a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/importer/shared/postprocess/EventFileResourcePostProcessor.java +++ b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/events/importer/shared/postprocess/EventFileResourcePostProcessor.java @@ -51,7 +51,8 @@ public void process(Event event, WorkContext ctx) { if (dataElement.isFileType()) { FileResource fileResource = fileResourceService.getFileResource(dataValue.getValue()); - if (!fileResource.isAssigned() || fileResource.getFileResourceOwner() == null) { + if (fileResource != null + && (!fileResource.isAssigned() || fileResource.getFileResourceOwner() == null)) { fileResource.setAssigned(true); fileResource.setFileResourceOwner(event.getEvent()); fileResourceService.updateFileResource(fileResource);