Fixed issue [2847](https://github.com/k9mail/k-9/issues/2847).
@@ -246,11 +246,16 @@ public class QuotedMessagePresenter {
}
if (messageFormat == MessageFormat.HTML) {
+ String bodyText; // defaults to null
Part part = MimeUtility.findFirstPartByMimeType(messageViewInfo.message, "text/html");
if (part != null) { // Shouldn't happen if we were the one who saved it.
quotedTextFormat = SimpleMessageFormat.HTML;
String text = MessageExtractor.getTextFromPart(part);
+ if (text == null) {
+ Timber.d("Empty message; skipping.");
+ bodyText = "";
+ } else {
Timber.d("Loading message with offset %d, length %d. Text length is %d.",
bodyOffset, bodyLength, text.length());
@@ -261,7 +266,8 @@ public class QuotedMessagePresenter {
bodyLength = 0;
}
// Grab our reply text.
- String bodyText = text.substring(bodyOffset, bodyOffset + bodyLength);
+ bodyText = text.substring(bodyOffset, bodyOffset + bodyLength);
+ }
view.setMessageContentCharacters(HtmlConverter.htmlToText(bodyText));
// Regenerate the quoted html without our user content in it.
