From 59d84e5b77e2aa20c7b3368279676b6de6af1bf2 Mon Sep 17 00:00:00 2001 From: rabia23 Date: Tue, 18 Apr 2017 11:25:56 +0000 Subject: [PATCH] TNL-6666 Fix 500 error when entering courseware. --- lms/djangoapps/courseware/views/index.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lms/djangoapps/courseware/views/index.py b/lms/djangoapps/courseware/views/index.py index 8bcc292d85..7de2fcc051 100644 --- a/lms/djangoapps/courseware/views/index.py +++ b/lms/djangoapps/courseware/views/index.py @@ -388,9 +388,15 @@ class CoursewareIndex(View): if self.section.position and self.section.has_children: display_items = self.section.get_display_items() if display_items: - courseware_context['sequence_title'] = display_items[self.section.position - 1] \ - .display_name_with_default - + try: + courseware_context['sequence_title'] = display_items[self.section.position - 1] \ + .display_name_with_default + except IndexError: + log.info("Course section {} with position {} and total section display items: {}".format( + self.section.display_name_with_default, + self.section.position, + len(display_items), + )) return courseware_context def _add_entrance_exam_to_context(self, courseware_context):