From: David ‘Bombe’ Roden Date: Thu, 24 Mar 2011 07:11:33 +0000 (+0100) Subject: Allow parsing without an origin Sone. X-Git-Tag: beta-freefall-0.6.2-1~75 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=ec54e35aad9f1dd299f50b9f366dabd3a3438fea;p=Sone.git Allow parsing without an origin Sone. --- diff --git a/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java b/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java index 704792c..0a50a62 100644 --- a/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java +++ b/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java @@ -166,7 +166,7 @@ public class FreenetLinkParser implements Parser { 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. */