X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Ftext%2FSoneTextParser.java;h=4195516e5a628073a53a64f87ca77da1476a59a6;hb=0d63b856de825269b5ebb7dc02886fa9fd4d75cf;hp=2787d527db1567dffc9903e60002abf2c13d4e52;hpb=ff0704341bf464cf0d15125962b082e71a038ab7;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index 2787d52..4195516 100644 --- a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java +++ b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java @@ -182,7 +182,7 @@ public class SoneTextParser implements Parser { if (line.length() >= (next + 7 + 43)) { String soneId = line.substring(next + 7, next + 50); Sone sone = soneProvider.getSone(soneId, false); - if (sone != null) { + if ((sone != null) && (sone.getName() != null)) { parts.add(new SonePart(sone)); } else { parts.add(new PlainTextPart(line.substring(next, next + 50))); @@ -202,8 +202,6 @@ public class SoneTextParser implements Parser { String postId = line.substring(next + 7, next + 43); Post post = postProvider.getPost(postId, false); if ((post != null) && (post.getSone() != null)) { - String postText = post.getText(); - postText = postText.substring(0, Math.min(postText.length(), 20)) + "…"; parts.add(new PostPart(post)); } else { parts.add(new PlainTextPart(line.substring(next, next + 43))); @@ -225,7 +223,9 @@ public class SoneTextParser implements Parser { if (!lastLineEmpty && lineComplete) { parts.add(new PlainTextPart("\n" + line.substring(0, next))); } else { - parts.add(new PlainTextPart(line.substring(0, next))); + if (next > 0) { + parts.add(new PlainTextPart(line.substring(0, next))); + } } String link = line.substring(next, nextSpace); String name = link;