Browse Source

Check if you have any TMs

Piotr Czajkowski 3 years ago
parent
commit
ee344a2b0a
1 changed files with 7 additions and 1 deletions
  1. 7 1
      server.go

+ 7 - 1
server.go

@@ -33,7 +33,13 @@ func displaySearchResults(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	searchResults := app.search(app.getTMs(info.LanguageCode), info.Phrase)
+	tms := app.getTMs(info.LanguageCode)
+	if len(tms) == 0 {
+		errorPage.Execute(w, "Couldn't get TMs!")
+		return
+	}
+
+	searchResults := app.search(tms, info.Phrase)
 	info.ResultsServed = searchResults.TotalResults
 	writeLog(info)