diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index 503245a3390e95aa976b0b33b31592ba3364f9c5..9bb012e910e5aa9d314f75c9bae497a3af1e7d22 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -91,6 +91,9 @@ class Connection {
 	public function getConnectionResource() {
 		if(!$this->ldapConnectionRes) {
 			$this->init();
+		} else if(!is_resource($this->ldapConnectionRes)) {
+			$this->ldapConnectionRes = null;
+			$this->establishConnection();
 		}
 		if(is_null($this->ldapConnectionRes)) {
 			\OCP\Util::writeLog('user_ldap', 'Connection could not be established', \OCP\Util::ERROR);