From d8578cfa1024b2428a09979bdcf683163fc33382 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20=E2=80=98Bombe=E2=80=99=20Roden?= Date: Thu, 6 Jan 2011 14:39:33 +0100 Subject: [PATCH] Shorten a possible invalid link in a safer way. --- src/main/java/net/pterodactylus/sone/text/FreenetLinkParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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())); } } } -- 2.7.4