Better error handling for mailbox lists
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 7 Jul 2009 21:21:04 +0000 (15:21 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 7 Jul 2009 21:21:04 +0000 (15:21 -0600)
imp/lib/Contents.php
imp/message.php

index 1e8fc49..4dbeb3c 100644 (file)
@@ -129,10 +129,15 @@ class IMP_Contents
                 $ret = $GLOBALS['imp_imap']->ob->fetch($this->_mailbox, array(
                     Horde_Imap_Client::FETCH_STRUCTURE => array('parse' => true)
                 ), array('ids' => array($this->_index)));
-                $this->_message = $ret[$this->_index]['structure'];
             } catch (Horde_Imap_Client_Exception $e) {
                 throw new Horde_Exception('Error displaying message.');
             }
+
+            if (!isset($ret[$this->_index]['structure'])) {
+                throw new Horde_Exception('Error displaying message.');
+            }
+
+            $this->_message = $ret[$this->_index]['structure'];
         }
     }
 
index 0733b30..6c1c8e8 100644 (file)
@@ -202,6 +202,7 @@ $mailbox_name = $index_array['mailbox'];
 try {
     $imp_contents = &IMP_Contents::singleton($index . IMP::IDX_SEP . $mailbox_name);
 } catch (Horde_Exception $e) {
+    $imp_mailbox->removeMsgs(true);
     _returnToMailbox(null, 'message_missing');
     require IMP_BASE . '/mailbox.php';
     exit;