From fbe777d0cd68314a5ef2458a8dd0da65494c3bed Mon Sep 17 00:00:00 2001 From: Floens Date: Tue, 2 Jan 2018 20:26:37 +0100 Subject: [PATCH] fix post quote for null extra texts. --- .../chan/core/presenter/ReplyPresenter.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Clover/app/src/main/java/org/floens/chan/core/presenter/ReplyPresenter.java b/Clover/app/src/main/java/org/floens/chan/core/presenter/ReplyPresenter.java index 7ef450ee..54cd1b77 100644 --- a/Clover/app/src/main/java/org/floens/chan/core/presenter/ReplyPresenter.java +++ b/Clover/app/src/main/java/org/floens/chan/core/presenter/ReplyPresenter.java @@ -299,13 +299,15 @@ public class ReplyPresenter implements AuthenticationLayoutCallback, ImagePickDe String postQuote = post != null ? ">>" + post.no + "\n" : ""; StringBuilder textQuoteResult = new StringBuilder(); - String[] lines = textQuote.split("\n+"); - // matches for >>123, >>123 (OP), >>123 (You), >>>/fit/123 - final Pattern quotePattern = Pattern.compile("^>>(>/[a-z0-9]+/)?\\d+.*$"); - for (String line : lines) { - // do not include post no from quoted post - if (!quotePattern.matcher(line).matches()) { - textQuoteResult.append(">").append(line).append("\n"); + if (textQuote != null) { + String[] lines = textQuote.split("\n+"); + // matches for >>123, >>123 (OP), >>123 (You), >>>/fit/123 + final Pattern quotePattern = Pattern.compile("^>>(>/[a-z0-9]+/)?\\d+.*$"); + for (String line : lines) { + // do not include post no from quoted post + if (!quotePattern.matcher(line).matches()) { + textQuoteResult.append(">").append(line).append("\n"); + } } }