From 21e6fddf1a6697900f24f303a55da4ddda9c66f1 Mon Sep 17 00:00:00 2001 From: Raymond Feng Date: Fri, 6 Sep 2013 13:42:12 -0700 Subject: [PATCH] Check the filter param to make sure we have a default value sls-sample-app is failing if we hit http://localhost:3000/locations/findOne In this case, a undefined param is passed in. The fix now sets it to {} if the value is undefined/null --- lib/dao.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/dao.js b/lib/dao.js index 1c18853c..b172298c 100644 --- a/lib/dao.js +++ b/lib/dao.js @@ -469,6 +469,7 @@ DataAccessObject.findOne = function findOne(params, cb) { cb = params; params = {}; } + params = params || {}; params.limit = 1; this.find(params, function (err, collection) { if (err || !collection || !collection.length > 0) return cb(err, null);