From aec92c6c091dab40549417d1cbe8988797f8b682 Mon Sep 17 00:00:00 2001 From: Ali-Salman29 Date: Thu, 21 Nov 2024 15:53:49 +0100 Subject: [PATCH] fix: Handle empty course_overviews in get_courses_order_by function --- cms/djangoapps/contentstore/views/course.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cms/djangoapps/contentstore/views/course.py b/cms/djangoapps/contentstore/views/course.py index 9f6cfb7c430e..ed0787833881 100644 --- a/cms/djangoapps/contentstore/views/course.py +++ b/cms/djangoapps/contentstore/views/course.py @@ -621,6 +621,8 @@ def get_courses_order_by(order_query, course_overviews): order_query (str): any string used to order Course Overviews. course_overviews (Course Overview objects): queryset to be ordered. """ + if not course_overviews: + return [] if not order_query: return course_overviews try: