diff --git a/inc/auth/mysql.class.php b/inc/auth/mysql.class.php
index da89dd8458e5a80feef6eb7aefba5f2738f12a0d..aea11d35fd52dbdbf1d6a0ca44f38b1312a0bfbc 100644
--- a/inc/auth/mysql.class.php
+++ b/inc/auth/mysql.class.php
@@ -342,9 +342,11 @@ class auth_mysql extends auth_basic {
         $sql .= " ".$this->cnf['SortOrder']." LIMIT $first, $limit";
         $result = $this->_queryDB($sql);
 
-        foreach ($result as $user)
-          if (($info = $this->_getUserInfo($user['user'])))
-            $out[$user['user']] = $info;
+        if (!empty($result)) {
+          foreach ($result as $user)
+            if (($info = $this->_getUserInfo($user['user'])))
+              $out[$user['user']] = $info;
+        }
 
         $this->_unlockTables();
         $this->_closeDB();