Fix panic in vehicle selection

This commit is contained in:
andig 2022-12-29 11:48:26 +01:00
parent 329bbc5d5b
commit f5913956b6

View file

@ -356,12 +356,13 @@ func vehicleHandler(site site.API, loadpoint loadpoint.API) http.HandlerFunc {
return
}
loadpoint.SetVehicle(vehicles[val-1])
v := vehicles[val-1]
loadpoint.SetVehicle(v)
res := struct {
Vehicle string `json:"vehicle"`
}{
Vehicle: vehicles[val].Title(),
Vehicle: v.Title(),
}
jsonResult(w, res)