diff --git a/modules/contest.js b/modules/contest.js index 303de97..dbc8151 100644 --- a/modules/contest.js +++ b/modules/contest.js @@ -83,7 +83,11 @@ app.post('/contest/:id/edit', async (req, res) => { ranklist = contest.ranklist; } - ranklist.ranking_params = JSON.parse(req.body.ranking_params); + try { + ranklist.ranking_params = JSON.parse(req.body.ranking_params); + } catch (e) { + ranklist.ranking_params = {}; + } await ranklist.save(); contest.ranklist_id = ranklist.id; diff --git a/views/contest_edit.ejs b/views/contest_edit.ejs index 7a09d68..f0ba65a 100644 --- a/views/contest_edit.ejs +++ b/views/contest_edit.ejs @@ -48,7 +48,7 @@