From e8bcdaeccc824ded9ea47c06644f66634f76fe75 Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Tue, 24 Mar 2020 08:45:12 +0100
Subject: [PATCH] OO-4592: check parents in rare branch of curriculum
 comparator

---
 .../ui/component/CurriculumElementViewsRowComparator.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/olat/modules/curriculum/ui/component/CurriculumElementViewsRowComparator.java b/src/main/java/org/olat/modules/curriculum/ui/component/CurriculumElementViewsRowComparator.java
index 07a39346aa7..574c33b97f0 100644
--- a/src/main/java/org/olat/modules/curriculum/ui/component/CurriculumElementViewsRowComparator.java
+++ b/src/main/java/org/olat/modules/curriculum/ui/component/CurriculumElementViewsRowComparator.java
@@ -62,7 +62,12 @@ public class CurriculumElementViewsRowComparator extends FlexiTreeNodeComparator
 			// This case is usually not possible
 			CurriculumElementWithViewsRow p1 = c1.getParent();
 			CurriculumElementWithViewsRow p2 = c2.getParent();
-			c = compareCurriculumElements(p1, p2);
+			if(p1 == null || p2 == null) {
+				// reversed because no parent at the top, higher in the hierarchy
+				c = -compareNullObjects(p1, p2); 
+			} else {
+				c = compareCurriculumElements(p1, p2);
+			}
 		} else {
 			// This case is usually not possible
 			c = compareDisplayName(c1, c2);
-- 
GitLab