Error catching; fix wrong varname.
authorMichael M Slusarz <slusarz@curecanti.org>
Thu, 4 Dec 2008 19:48:07 +0000 (12:48 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Thu, 4 Dec 2008 21:29:06 +0000 (14:29 -0700)
imp/lib/Views/ShowMessage.php

index 15fa526..e3c2474 100644 (file)
@@ -125,11 +125,15 @@ class IMP_Views_ShowMessage
             $flags_ret = $GLOBALS['imp_imap']->ob->fetch($folder, array(
                 Horde_Imap_Client::FETCH_FLAGS => true,
             ), array('ids' => array($index)));
+            if (!isset($flags_ret[$index])) {
+                $result['error'] = $error_msg;
+                $result['errortype'] = 'horde.error';
+                return $result;
+            }
             $fetch_ret = $GLOBALS['imp_imap']->ob->fetch($folder, array(
                 Horde_Imap_Client::FETCH_ENVELOPE => true,
                 Horde_Imap_Client::FETCH_HEADERTEXT => array(array('parse' => true, 'peek' => false))
             ), array('ids' => array($index)));
-            $ob = $fetch_ret[$index];
         } catch (Horde_Imap_Client_Exception $e) {
             $result['error'] = $error_msg;
             $result['errortype'] = 'horde.error';
@@ -210,7 +214,7 @@ class IMP_Views_ShowMessage
         /* Get minidate. */
         if ($preview) {
             $imp_mailbox_ui = new IMP_UI_Mailbox();
-            $minidate = $imp_mailbox_ui->getDate($ob['envelope']['date']);
+            $minidate = $imp_mailbox_ui->getDate($envelope['date']);
             if (empty($minidate)) {
                 $minidate = _("Unknown Date");
             }