From 62df283157ff32dded77e833fbd0f4e3007acbbe Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 17 Jan 2018 13:33:50 +0300 Subject: prevent nulls with StringUtils.defaultString() --- juick-api/src/main/java/com/juick/api/CrosspostManager.java | 2 +- juick-api/src/main/java/com/juick/api/controllers/Post.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'juick-api/src/main') diff --git a/juick-api/src/main/java/com/juick/api/CrosspostManager.java b/juick-api/src/main/java/com/juick/api/CrosspostManager.java index 13f21074..a601d7b7 100644 --- a/juick-api/src/main/java/com/juick/api/CrosspostManager.java +++ b/juick-api/src/main/java/com/juick/api/CrosspostManager.java @@ -153,7 +153,7 @@ public class CrosspostManager implements ApplicationListener { private void twitterPost(final com.juick.Message jmsg) { crosspostService.getTwitterToken(jmsg.getUser().getUid()).ifPresent(t -> { - String status = MessageUtils.getMessageHashTags(jmsg) + jmsg.getText(); + String status = MessageUtils.getMessageHashTags(jmsg) + StringUtils.defaultString(jmsg.getText()); if (status.length() > 255) { status = status.substring(0, 254) + "…"; } diff --git a/juick-api/src/main/java/com/juick/api/controllers/Post.java b/juick-api/src/main/java/com/juick/api/controllers/Post.java index 27a0e3c8..a89786b1 100644 --- a/juick-api/src/main/java/com/juick/api/controllers/Post.java +++ b/juick-api/src/main/java/com/juick/api/controllers/Post.java @@ -168,7 +168,7 @@ public class Post { xmsg.setThread("juick-" + mid); xmsg.addExtension(jmsg); - String quote = reply != null ? reply.getText() : msg.getText(); + String quote = reply != null ? StringUtils.defaultString(reply.getText()) : StringUtils.defaultString(msg.getText()); if (quote.length() >= 50) { quote = quote.substring(0, 47) + "..."; } -- cgit v1.2.3