Don't attempt to expand an empty address field
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 16 Nov 2009 20:58:42 +0000 (13:58 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 16 Nov 2009 21:13:16 +0000 (14:13 -0700)
imp/lib/UI/Compose.php

index 0efbbe5..d19ca69 100644 (file)
@@ -17,13 +17,18 @@ class IMP_UI_Compose
      */
     public function expandAddresses($input, $imp_compose)
     {
-        $result = $imp_compose->expandAddresses($this->getAddressList($input));
+        $addr_list = $this->getAddressList($input);
+        if (empty($addr_list)) {
+            return '';
+        }
+
+        $res = $imp_compose->expandAddresses($addr_list);
 
-        if (is_array($result)) {
+        if (is_array($res)) {
             $GLOBALS['notification']->push(_("Please resolve ambiguous or invalid addresses."), 'horde.warning');
         }
 
-        return $result;
+        return $res;
     }
 
     /**
@@ -129,7 +134,7 @@ class IMP_UI_Compose
     /**
      */
     public function getAddressList($to, $to_list = array(), $to_field = array(),
-                            $to_new = '', $expand = false)
+                                   $to_new = '', $expand = false)
     {
         $to = rtrim(trim($to), ',');
         if (!empty($to)) {