From 8772ace8cecdc303f80545992e9c8e1fdea3541c Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Thu, 15 Oct 2020 07:29:06 +0200
Subject: [PATCH] OO-4978: task definition item can be null (rare)

---
 .../java/org/olat/course/nodes/gta/manager/GTAManagerImpl.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/org/olat/course/nodes/gta/manager/GTAManagerImpl.java b/src/main/java/org/olat/course/nodes/gta/manager/GTAManagerImpl.java
index 9db8a15da70..478c67bc28a 100644
--- a/src/main/java/org/olat/course/nodes/gta/manager/GTAManagerImpl.java
+++ b/src/main/java/org/olat/course/nodes/gta/manager/GTAManagerImpl.java
@@ -230,8 +230,8 @@ public class GTAManagerImpl implements GTAManager {
 			if(deleteFile) {
 				VFSContainer tasksContainer = getTasksContainer(courseEnv, cNode);
 				VFSItem item = tasksContainer.resolve(removedTask.getFilename());
-				deleteEdusharingUsages(courseEnv, item);
 				if(item != null) {
+					deleteEdusharingUsages(courseEnv, item);
 					item.delete();
 				}
 			}
-- 
GitLab