From a66cf74c5c23af0466d7510905e34ffb8153b9a2 Mon Sep 17 00:00:00 2001 From: aarif Date: Tue, 27 Aug 2019 18:41:48 +0500 Subject: [PATCH] fixed NoneType and integer comparison issue --- lms/djangoapps/courseware/courses.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lms/djangoapps/courseware/courses.py b/lms/djangoapps/courseware/courses.py index 1538e80b94..d207fb0c61 100644 --- a/lms/djangoapps/courseware/courses.py +++ b/lms/djangoapps/courseware/courses.py @@ -608,7 +608,7 @@ def get_current_child(xmodule, min_depth=None, requested_child=None): def _get_default_child_module(child_modules): """Returns the first child of xmodule, subject to min_depth.""" - if min_depth <= 0: + if min_depth is None or min_depth <= 0: return _get_child(child_modules) else: content_children = [ @@ -625,7 +625,7 @@ def get_current_child(xmodule, min_depth=None, requested_child=None): pos = xmodule.position - 1 # position is 1-indexed if 0 <= pos < len(children): child = children[pos] - if min_depth > 0 and not child.has_children_at_depth(min_depth - 1): + if min_depth is not None and (min_depth > 0 and not child.has_children_at_depth(min_depth - 1)): child = None if child is None: child = _get_default_child_module(children)