fix PHP error: Call to a member function contentTypeMap() on null

This commit is contained in:
Ralf Becker 2021-04-08 10:19:15 +02:00
parent 7a4811213b
commit 8daf1f43f7

View File

@ -6092,7 +6092,7 @@ class Mail
* @param string $_part * @param string $_part
* @param boolean $_stream = null null do NOT fetch content, use fetchPartContents later * @param boolean $_stream = null null do NOT fetch content, use fetchPartContents later
* true: * true:
* @return Horde_Mime_Part * @return Horde_Mime_Part|false false on error / not found
*/ */
function getAttachmentByCID($_uid, $_cid, $_part, $_stream=null) function getAttachmentByCID($_uid, $_cid, $_part, $_stream=null)
{ {
@ -6106,6 +6106,8 @@ class Mail
{ {
$structure = $this->getStructure($uid=$_uid, $part=$_part); $structure = $this->getStructure($uid=$_uid, $part=$_part);
} }
if (!$structure) return false;
/** @var Horde_Mime_Part */ /** @var Horde_Mime_Part */
$attachment = null; $attachment = null;
foreach($structure->contentTypeMap() as $mime_id => $mime_type) foreach($structure->contentTypeMap() as $mime_id => $mime_type)