Fix set_status 500 ing when beatmap is not found by ID

This commit is contained in:
Howl 2016-06-09 10:52:55 +02:00
parent d87027c85a
commit f32de541a4

View File

@ -98,7 +98,10 @@ func BeatmapSetStatusPOST(md common.MethodData) common.CodeMessager {
param := req.BeatmapsetID param := req.BeatmapsetID
if req.BeatmapID != 0 { if req.BeatmapID != 0 {
err := md.DB.QueryRow("SELECT beatmapset_id FROM beatmaps WHERE beatmap_id = ? LIMIT 1", req.BeatmapID).Scan(&param) err := md.DB.QueryRow("SELECT beatmapset_id FROM beatmaps WHERE beatmap_id = ? LIMIT 1", req.BeatmapID).Scan(&param)
if err != nil { switch {
case err == sql.ErrNoRows:
return common.SimpleResponse(404, "That beatmap could not be found!")
case err != nil:
md.Err(err) md.Err(err)
return Err500 return Err500
} }