diff --git a/node_modules/catalog.js b/node_modules/catalog.js index abe440b..a859e0f 100644 --- a/node_modules/catalog.js +++ b/node_modules/catalog.js @@ -77,17 +77,19 @@ Catalog.prototype.update = function(code) { } var newcrns = []; - for (var type in course.sections) { - course.sections[type].forEach((section) => { - var idx = oldcrns.indexOf(section.crn); - if (idx == -1) { - newcrns.push(section.crn); - } else { - oldcrns.splice(idx, 1); - } - this.sections[section.crn] = section; - section.course = course; - }); + if (oldcrns.length != 0) { + for (var type in course.sections) { + course.sections[type].forEach((section) => { + var idx = oldcrns.indexOf(section.crn); + if (idx == -1) { + newcrns.push(section.crn); + } else { + oldcrns.splice(idx, 1); + } + this.sections[section.crn] = section; + section.course = course; + }); + } } resolve({course: course, added: newcrns, removed: oldcrns}); }).bind(this), (err) => {