MDL-33862 Ensure that a chooserspan exists before trying to set it up
authorAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Tue, 19 Jun 2012 14:43:14 +0000 (15:43 +0100)
committerAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Tue, 19 Jun 2012 14:43:14 +0000 (15:43 +0100)
course/yui/modchooser/modchooser.js

index 6b73e68..f2c7207 100644 (file)
@@ -100,6 +100,9 @@ YUI.add('moodle-course-modchooser', function(Y) {
         },
         _setup_for_section : function(section, sectionid) {
             var chooserspan = section.one(CSS.SECTIONMODCHOOSER);
+            if (!chooserspan) {
+                return;
+            }
             var chooserlink = Y.Node.create("<a href='#' />");
             chooserspan.get('children').each(function(node) {
                 chooserlink.appendChild(node);