Don't set groups property if there aren't any.
authorJan Schneider <jan@horde.org>
Thu, 3 Jun 2010 11:59:38 +0000 (13:59 +0200)
committerJan Schneider <jan@horde.org>
Thu, 3 Jun 2010 11:59:38 +0000 (13:59 +0200)
framework/Ajax/lib/Horde/Ajax/Application/Base.php

index 4049ccd..d68c0b6 100644 (file)
@@ -133,19 +133,15 @@ abstract class Horde_Ajax_Application_Base
      */
     public function listGroups()
     {
+        $result = new stdClass;
         try {
             $horde_groups = Horde_Group::singleton();
             $groups = empty($GLOBALS['conf']['share']['any_group'])
                 ? $horde_groups->getGroupMemberships($GLOBALS['registry']->getAuth(), true)
                 : $horde_groups->listGroups();
             asort($groups);
-        } catch (Horde_Group_Exception $e) {
-            $groups = array();
-        }
-
-        $result = new stdClass;
-        $result->groups = $groups;
-
+            $result->groups = $groups;
+        } catch (Horde_Group_Exception $e) { }
         return $result;
     }