From b05d59b318a5eb06831bc31a6f13c2a5ea5ffb18 Mon Sep 17 00:00:00 2001 From: Paul van Tilburg Date: Tue, 14 Feb 2012 23:48:19 +0100 Subject: [PATCH] Prevent trying to update items that are not in the database --- app.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app.js b/app.js index 7f897bd..021f0a5 100644 --- a/app.js +++ b/app.js @@ -330,6 +330,10 @@ app.get('/draggables/:id', function(req, res) { // i.e. the global state. app.post('/draggables/:id', function(req, res) { var drag = draggables[req.params.id]; + if (!drag) { + res.send(false); + return; + } if (req.body.title) { // It's a title update! console.log("Title update for draggable " + req.params.id + ": " +