Redirect to index if no phrases have been found.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / SearchPage.java
index 6f5e001..d50a254 100644 (file)
@@ -83,6 +83,9 @@ public class SearchPage extends SoneTemplatePage {
                }
 
                List<Phrase> phrases = parseSearchPhrases(query);
+               if (phrases.isEmpty()) {
+                       throw new RedirectException("index.html");
+               }
 
                Set<Sone> sones = webInterface.getCore().getSones();
                Set<Hit<Sone>> soneHits = getHits(sones, phrases, SoneStringGenerator.COMPLETE_GENERATOR);