From 8435ce9d2478b665436cc55c5974f31132c96dd4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Tue, 27 Sep 2011 13:45:19 +0200 Subject: [PATCH] Always add a Sone part for the ID. --- src/main/java/net/pterodactylus/sone/text/SoneTextParser.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java index 051c02a..5c12831 100644 --- a/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java +++ b/src/main/java/net/pterodactylus/sone/text/SoneTextParser.java @@ -202,11 +202,14 @@ public class SoneTextParser implements Parser { if (line.length() >= (7 + 43)) { String soneId = line.substring(7, 50); Sone sone = soneProvider.getSone(soneId, false); - if ((sone != null) && (sone.getName() != null)) { - parts.add(new SonePart(sone)); - } else { - parts.add(new PlainTextPart(line.substring(0, 50))); + if (sone == null) { + /* + * don’t use create=true above, we don’t want the + * empty shell. + */ + sone = new Sone(soneId); } + parts.add(new SonePart(sone)); line = line.substring(50); } else { parts.add(new PlainTextPart(line)); -- 2.7.4