]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed warning
authorvyshane <vyshane>
Tue, 5 Sep 2006 03:07:56 +0000 (03:07 +0000)
committervyshane <vyshane>
Tue, 5 Sep 2006 03:07:56 +0000 (03:07 +0000)
lib/accesslib.php

index 2b3909067c54ddeb6515fb698be312cedf8555d3..e4f7757b36daed156d5b43a7f92c97b768ec70eb 100755 (executable)
@@ -1592,15 +1592,16 @@ function role_context_capabilities($roleid, $context, $cap='') {
             and rc.contextid = c.id $search
             ORDER BY c.aggregatelevel DESC, rc.capability DESC";
   
-    $records = get_records_sql($SQL);
     $capabilities = array();
     
-    // We are traversing via reverse order.
-    foreach ($records as $record) {
-          // If not set yet (i.e. inherit or not set at all), or currently we have a prohibit
-        if (!isset($capabilities[$record->capability]) || $record->permission<-500) {
-            $capabilities[$record->capability] = $record->permission;
-        }  
+    if ($records = get_records_sql($SQL)) {
+        // We are traversing via reverse order.
+        foreach ($records as $record) {
+            // If not set yet (i.e. inherit or not set at all), or currently we have a prohibit
+            if (!isset($capabilities[$record->capability]) || $record->permission<-500) {
+                $capabilities[$record->capability] = $record->permission;
+            }  
+        }
     }
     return $capabilities;
 }