Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 24de0df7 authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #2867 from jyn514/issue-2847

Avoid exception when processing draft message

Fixes #2847
parents 9fdcf441 243b8319
Loading
Loading
Loading
Loading
+16 −10
Original line number Diff line number Diff line
@@ -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.