diff --git a/index.js b/index.js index d886b6c..74c67f9 100644 --- a/index.js +++ b/index.js @@ -176,7 +176,9 @@ router.post('/lister/:liste/blimed', requireAuth, (req, res) => { router.post('/lister/:liste/meldav', requireAuth, (req, res) => { const user = req.user; - user.lister.splice(user.lister.indexOf(req.params.liste), 1); + if (user.lister.indexOf(req.params.liste) > -1) { + user.lister.splice(user.lister.indexOf(req.params.liste), 1); + } user.save(); res.json({ message: 'Ok',