From: David ‘Bombe’ Roden Date: Tue, 12 Jul 2011 04:28:53 +0000 (+0200) Subject: Redirect to index if no phrases have been found. X-Git-Tag: 0.6.6^2~21 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=084e8ed97fd315caadb5051e21ed50c29be9de0e;p=Sone.git Redirect to index if no phrases have been found. --- diff --git a/src/main/java/net/pterodactylus/sone/web/SearchPage.java b/src/main/java/net/pterodactylus/sone/web/SearchPage.java index 6f5e001..d50a254 100644 --- a/src/main/java/net/pterodactylus/sone/web/SearchPage.java +++ b/src/main/java/net/pterodactylus/sone/web/SearchPage.java @@ -83,6 +83,9 @@ public class SearchPage extends SoneTemplatePage { } List phrases = parseSearchPhrases(query); + if (phrases.isEmpty()) { + throw new RedirectException("index.html"); + } Set sones = webInterface.getCore().getSones(); Set> soneHits = getHits(sones, phrases, SoneStringGenerator.COMPLETE_GENERATOR);