From 081787d6ae32e743923cae3ec5772431085443cf Mon Sep 17 00:00:00 2001
From: Morris Jobke <hey@morrisjobke.de>
Date: Tue, 11 Nov 2014 12:15:30 +0100
Subject: [PATCH] Fix infinite loop if count and limit is 0

* otherwise it will always think it hits the limit and need another round to fetch additional results
---
 apps/user_ldap/lib/access.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php
index 12c6f8118d3..d89029abf17 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -928,7 +928,7 @@ class Access extends LDAPUtility implements user\IUserTools {
 		foreach($searchResults as $res) {
 			$count = intval($this->ldap->countEntries($cr, $res));
 			$counter += $count;
-			if($count === $limit) {
+			if($count > 0 && $count === $limit) {
 				$hasHitLimit = true;
 			}
 		}
-- 
GitLab