MDL-17492 Do not try to access the first key of an empty array in case of no tag...
authormudrd8mz <mudrd8mz>
Mon, 2 Mar 2009 21:51:25 +0000 (21:51 +0000)
committermudrd8mz <mudrd8mz>
Mon, 2 Mar 2009 21:51:25 +0000 (21:51 +0000)
tag/locallib.php

index 71597baad3c65b7fa5fd48083967c8243f554ce8..aaa0283ba99edf72db3c872c1b6c680c29e370ca 100644 (file)
@@ -31,8 +31,10 @@ function tag_print_cloud($nr_of_tags=150, $return=false) {
     }
 
     $tagkeys = array_keys($tagsincloud);
-    $firsttagkey = $tagkeys[0];
-    $maxcount = $tagsincloud[$firsttagkey]->count;
+    if (!empty($tagkeys)) {
+        $firsttagkey = $tagkeys[0];
+        $maxcount = $tagsincloud[$firsttagkey]->count;
+    }
 
     $etags = array();