File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
www/core/components/courses/services Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -140,14 +140,19 @@ angular.module('mm.core.courses')
140140 */
141141 self . getUserCourse = function ( id , preferCache , siteid ) {
142142 siteid = siteid || $mmSite . getId ( ) ;
143+
144+ if ( ! id ) {
145+ return $q . reject ( ) ;
146+ }
147+
143148 if ( typeof preferCache == 'undefined' ) {
144149 preferCache = false ;
145150 }
146151
147152 return self . getUserCourses ( preferCache , siteid ) . then ( function ( courses ) {
148153 var course ;
149154 angular . forEach ( courses , function ( c ) {
150- if ( c . id === id ) {
155+ if ( c . id == id ) {
151156 course = c ;
152157 }
153158 } ) ;
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ angular.module('mm.core.courses')
160160 } ) . finally ( function ( ) {
161161 // Update handlers for all courses.
162162 angular . forEach ( coursesHandlers , function ( handler , courseId ) {
163- self . updateNavHandlersForCourse ( courseId ) ;
163+ self . updateNavHandlersForCourse ( parseInt ( courseId ) ) ;
164164 } ) ;
165165 } ) ;
166166 } ;
You can’t perform that action at this time.
0 commit comments