diff --git a/lib/editor/tinymce/plugins/moodlenolink/tinymce/editor_plugin.js b/lib/editor/tinymce/plugins/moodlenolink/tinymce/editor_plugin.js
index <HASH>..<HASH> 100644
--- a/lib/editor/tinymce/plugins/moodlenolink/tinymce/editor_plugin.js
+++ b/lib/editor/tinymce/plugins/moodlenolink/tinymce/editor_plugin.js
@@ -43,6 +43,10 @@
             ed.onNodeChange.add(function(ed, cm, n) {
                 var p, c;
                 c = cm.get('moodlenolink');
+                if (!c) {
+                    // Button not used.
+                    return;
+                }
                 p = ed.dom.getParent(n, 'SPAN');
 
                 c.setActive(p && ed.dom.hasClass(p, 'nolink'));
MDL-<I> fix JS error when moodlenolink button not present in toolbar

Thanks Rossiani Wijaya for discovering this issue!