From: David ‘Bombe’ Roden Date: Thu, 6 Jan 2011 13:39:33 +0000 (+0100) Subject: Shorten a possible invalid link in a safer way. X-Git-Tag: 0.3.6.4^2~1 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=d8578cfa1024b2428a09979bdcf683163fc33382;p=Sone.git Shorten a possible invalid link in a safer way. --- diff --git a/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java b/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java index fbf87c8..b50113d 100644 --- a/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java +++ b/src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java @@ -178,7 +178,7 @@ public class FreenetLinkParser implements Parser { name = name.substring(name.lastIndexOf('/', name.lastIndexOf('/') - 1)); } else { /* shorten to 5 chars. */ - name = name.substring(4, 9); + name = name.substring(4, Math.min(9, name.length())); } } }