Fix possible edge case

Fixes the possible edge case where submitting the fourm but not setting an event name would clear the event name.
This commit is contained in:
Evan Pratten
2018-11-10 16:41:38 -05:00
committed by Patrick Fairbank
parent 9717c17765
commit 7bcfea4aaa

View File

@@ -33,7 +33,13 @@ func (web *Web) settingsPostHandler(w http.ResponseWriter, r *http.Request) {
}
eventSettings := web.arena.EventSettings
previousName = eventSettings.Name
eventSettings.Name = r.PostFormValue("name")
if len(eventSettings.Name) < 1 && perviousName == "Untitled Event"{
eventSettings.Name = "Untitled Event"
}
numAlliances, _ := strconv.Atoi(r.PostFormValue("numElimAlliances"))
if numAlliances < 2 || numAlliances > 16 {
web.renderSettings(w, r, "Number of alliances must be between 2 and 16.")