FIX: prevents exception on malformatted messages (PR #13997)

The following example message would generate an exception:

Return-Path: <discourse@bar.com>
From: Foo Bar <discourse@bar.com>
To: reply+4f97315cc828096c9cb34c6f1a0d6fe8@bar.com
Date: Fri, 15 Jan 2016 00:12:43 +0100
Message-ID: <21@foo.bar.mail>
Mime-Version: 1.0
Content-Type: text/html; charset=UTF-8

</div>

Exception:

NoMethodError:
       undefined method `split' for nil:NilClass

GitHub

The split returns an empty array only when reply is empty as well. I think we should bail out early in that case.

def trim_discourse_markers(reply)
  return "" if reply.blank?
  reply = reply.split(previous_replies_regex)[0]
  reply = reply.split(reply_above_line_regex)[0]
end

change made