From 75c686ea928b3e06553df4cb9ea6e5331a79bcf0 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Wed, 19 Mar 2014 08:47:19 -0500
Subject: [PATCH] email: Fix possible crash if no body in email

---
 include/class.mailfetch.php | 3 ++-
 include/class.mailparse.php | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php
index f1ea77d74..dedfba84c 100644
--- a/include/class.mailfetch.php
+++ b/include/class.mailfetch.php
@@ -541,7 +541,8 @@ class MailFetcher {
             $body = new TextThreadBody(
                     Format::html2text(Format::safe_html($html),
                         100, false));
-        else
+
+        if (!isset($body))
             $body = new TextThreadBody('');
 
         if ($cfg->stripQuotedReply())
diff --git a/include/class.mailparse.php b/include/class.mailparse.php
index 0ec0b4f19..654e0e05e 100644
--- a/include/class.mailparse.php
+++ b/include/class.mailparse.php
@@ -292,7 +292,8 @@ class Mail_Parse {
             $body = new TextThreadBody(
                     Format::html2text(Format::safe_html($html),
                         100, false));
-        else
+
+        if (!isset($body))
             $body = new TextThreadBody('');
 
         if ($cfg && $cfg->stripQuotedReply())
-- 
GitLab