From 7d3e04b869a771e137a92bba4b151320228aa425 Mon Sep 17 00:00:00 2001 From: Noah Petherbridge Date: Sun, 10 Sep 2023 12:07:16 -0700 Subject: [PATCH] Fix age min/max filter on search page --- pkg/controller/account/search.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pkg/controller/account/search.go b/pkg/controller/account/search.go index 48aba96..5b20db2 100644 --- a/pkg/controller/account/search.go +++ b/pkg/controller/account/search.go @@ -39,13 +39,11 @@ func Search() http.HandlerFunc { friendSearch = r.FormValue("friends") == "true" sort = r.FormValue("sort") sortOK bool - ageMin int - ageMax int ) - ageMin, _ = strconv.Atoi(r.FormValue("age_min")) - ageMax, _ = strconv.Atoi(r.FormValue("age_max")) - if ageMin > ageMax { + ageMin, err1 := strconv.Atoi(r.FormValue("age_min")) + ageMax, err2 := strconv.Atoi(r.FormValue("age_max")) + if ageMin > ageMax && err1 == nil && err2 == nil { ageMin, ageMax = ageMax, ageMin }