diff --git a/course/mod.php b/course/mod.php
index <HASH>..<HASH> 100644
--- a/course/mod.php
+++ b/course/mod.php
@@ -343,7 +343,7 @@
         }
         exit;
 
-    } else if (!empty($groupmode) and confirm_sesskey()) {
+    } else if (isset($groupmode) and confirm_sesskey()) {
 
         $id = required_param( 'id', PARAM_INT );
Fixed group switch icon cannot set a module to use no groups