From 9a7c95eec9517be46bd75343e55cec9bd17e11d0 Mon Sep 17 00:00:00 2001 From: Arnau Sanchez Date: Thu, 25 Jul 2024 11:30:32 +0200 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/deprecated/tracker/importer/shared/postprocess/EventFileResourcePostProcessor.java b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/deprecated/tracker/importer/shared/postprocess/EventFileResourcePostProcessor.java index b3fd250d9630..fc036d09a0e0 100644 --- a/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/deprecated/tracker/importer/shared/postprocess/EventFileResourcePostProcessor.java +++ b/dhis-2/dhis-services/dhis-service-dxf2/src/main/java/org/hisp/dhis/dxf2/deprecated/tracker/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);