mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2025-01-18 04:59:02 +02:00
fixed bug where empty savefile is submitted
This commit is contained in:
parent
ed49b1137f
commit
8f7995d2e5
11
handlers.go
11
handlers.go
@ -454,6 +454,7 @@ func StartServer(w http.ResponseWriter, r *http.Request) {
|
||||
log.Printf("Error in starting factorio server handler body: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
log.Printf("Starting Factorio server with settings: %v", string(body))
|
||||
|
||||
err = json.Unmarshal(body, &FactorioServ)
|
||||
@ -462,6 +463,16 @@ func StartServer(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// Check if savefile was submitted with request to start server.
|
||||
if FactorioServ.Savefile == "" {
|
||||
log.Printf("Error starting Factorio server: %s", err)
|
||||
resp.Data = fmt.Sprintf("Error starting Factorio server: %s", err)
|
||||
if err := json.NewEncoder(w).Encode(resp); err != nil {
|
||||
log.Printf("Error encoding config file JSON reponse: ", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
go func() {
|
||||
err = FactorioServ.Run()
|
||||
if err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user