diff --git a/cms/static/js/models/settings/course_details.js b/cms/static/js/models/settings/course_details.js index 222d2fd11e..de4831e186 100644 --- a/cms/static/js/models/settings/course_details.js +++ b/cms/static/js/models/settings/course_details.js @@ -56,6 +56,7 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({ for (var i=0; i]+/g, _getNextMatch : function (regex, string, cursor) { regex.lastIndex = cursor; var result = regex.exec(string); @@ -141,12 +142,13 @@ CMS.Models.Settings.CourseDetails = Backbone.Model.extend({ cursor = 0; // parsed to "fff:kkk,fff:kkk" var result = new Array(); + if (!videostring || videostring.length == 0) return result; while (cursor < videostring.length) { var speed = this._getNextMatch(this._videospeedparse, videostring, cursor); if (speed) cursor = this._videospeedparse.lastIndex + 1; else return result; var key = this._getNextMatch(this._videokeyparse, videostring, cursor); - cursor = this._videokeyparse.lastIndex + 1; + if (key) cursor = this._videokeyparse.lastIndex + 1; // See the WTF above if (_.isArray(key)) key = key[0]; result.push({speed: speed, key: key});