Allow parsing without an origin Sone.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 24 Mar 2011 07:11:33 +0000 (08:11 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Thu, 24 Mar 2011 07:11:33 +0000 (08:11 +0100)
src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java

index 704792c..0a50a62 100644 (file)
@@ -166,7 +166,7 @@ public class FreenetLinkParser implements Parser<FreenetLinkParserContext> {
                                                        if (name == null) {
                                                                name = link.substring(0, Math.min(9, link.length()));
                                                        }
-                                                       boolean fromPostingSone = ((linkType == LinkType.SSK) || (linkType == LinkType.USK)) && link.substring(4, Math.min(link.length(), 47)).equals(context.getPostingSone().getId());
+                                                       boolean fromPostingSone = (context.getPostingSone() != null) && ((linkType == LinkType.SSK) || (linkType == LinkType.USK)) && link.substring(4, Math.min(link.length(), 47)).equals(context.getPostingSone().getId());
                                                        parts.add(fromPostingSone ? createTrustedFreenetLinkPart(link, name) : createFreenetLinkPart(link, name));
                                                } catch (MalformedURLException mue1) {
                                                        /* not a valid link, insert as plain text. */