From 6eb9c4d8bb240090e356fbaa75fc6f396078f444 Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Wed, 9 Jan 2019 16:43:54 +0100
Subject: [PATCH] OO-3803: the list of submitted documents can be null in rare
 case

---
 .../olat/course/nodes/gta/ui/GTAParticipantController.java    | 4 ++--
 .../olat/course/nodes/gta/ui/SubmitDocumentsController.java   | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/olat/course/nodes/gta/ui/GTAParticipantController.java b/src/main/java/org/olat/course/nodes/gta/ui/GTAParticipantController.java
index 51974e7b726..aa8d07d540e 100644
--- a/src/main/java/org/olat/course/nodes/gta/ui/GTAParticipantController.java
+++ b/src/main/java/org/olat/course/nodes/gta/ui/GTAParticipantController.java
@@ -260,11 +260,11 @@ public class GTAParticipantController extends GTAAbstractController implements A
 		File documentsDir;
 		VFSContainer documentsContainer;
 		if(GTAType.group.name().equals(config.getStringValue(GTACourseNode.GTASK_TYPE))) {
-			documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedGroup);
 			documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, assessedGroup);
+			documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, assessedGroup);
 		} else {
-			documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, getIdentity());
 			documentsContainer = gtaManager.getSubmitContainer(courseEnv, gtaNode, getIdentity());
+			documentsDir = gtaManager.getSubmitDirectory(courseEnv, gtaNode, getIdentity());
 		}
 		
 		DueDate dueDate = getSubmissionDueDate(task);
diff --git a/src/main/java/org/olat/course/nodes/gta/ui/SubmitDocumentsController.java b/src/main/java/org/olat/course/nodes/gta/ui/SubmitDocumentsController.java
index 94f7a736418..34996b3631e 100644
--- a/src/main/java/org/olat/course/nodes/gta/ui/SubmitDocumentsController.java
+++ b/src/main/java/org/olat/course/nodes/gta/ui/SubmitDocumentsController.java
@@ -177,6 +177,9 @@ class SubmitDocumentsController extends FormBasicController {
 	
 	private void updateModel() {
 		File[] documents = documentsDir.listFiles(new SystemFileFilter(true, false));
+		if(documents == null) {
+			documents = new File[0];
+		}
 		List<SubmittedSolution> docList = new ArrayList<>(documents.length);
 		for(File document:documents) {
 			String filename = document.getName();
-- 
GitLab