diff --git a/blocks/mnet_hosts/block_mnet_hosts.php b/blocks/mnet_hosts/block_mnet_hosts.php
index 1ef60b1746d..63a8ba19794 100644
--- a/blocks/mnet_hosts/block_mnet_hosts.php
+++ b/blocks/mnet_hosts/block_mnet_hosts.php
@@ -55,14 +55,16 @@ class block_mnet_hosts extends block_list {
$icon = "
pixpath/i/mnethost.png\"".
" class=\"icon\" alt=\"".get_string('server', 'block_mnet_hosts')."\" />";
- foreach ($hosts as $host) {
- $this->content->icons[]=$icon;
- $this->content->items[]="name).
- "\" href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$host->id}\">" . s($host->name) ."";
+ if ($hosts) {
+ foreach ($hosts as $host) {
+ $this->content->icons[]=$icon;
+ $this->content->items[]="name).
+ "\" href=\"{$CFG->wwwroot}/auth/mnet/jump.php?hostid={$host->id}\">" . s($host->name) ."";
+ }
}
return $this->content;
}
}
-?>
+?>
\ No newline at end of file