Hotfix to catch PEAR_Errors, still needs to be converted to Horde_Db. Catch if user...
authorJan <jan@horde.org>
Tue, 8 Jun 2010 17:52:11 +0000 (18:52 +0100)
committerJan Schneider <jan@horde.org>
Tue, 8 Jun 2010 17:58:57 +0000 (19:58 +0200)
framework/Group/lib/Horde/Group/Contactlists.php

index 493c37b..1b40ba9 100644 (file)
@@ -349,6 +349,9 @@ class Horde_Group_Contactlists extends Horde_Group
                         $owners[] = $params['name'];
                     }
                 }
+                if (!$owners) {
+                    return array();
+                }
             } else {
                 $owners = array($GLOBALS['registry']->getAuth());
             }
@@ -361,10 +364,14 @@ class Horde_Group_Contactlists extends Horde_Group
                 . $source['map']['__type'] . ' = \'Group\' AND '
                 . $source['map']['__owner'] . ' IN (' . implode(',', $owner_ids ) . ')';
 
-           $results = $this->_db[$key]->getAssoc($sql);
-           foreach ($results as $id => $name) {
-               $groups[$key . ':' . $id] = $name;
-           }
+            $results = $this->_db[$key]->getAssoc($sql);
+            if (is_a($results, 'PEAR_Error')) {
+                Horde::logMessage($results);
+                throw new Horde_Group_Exception($results);
+            }
+            foreach ($results as $id => $name) {
+                $groups[$key . ':' . $id] = $name;
+            }
         }
         $this->_groupList = $groups;