From c3b8d0b328c2759132a21dca7b28b1ac21efbedb Mon Sep 17 00:00:00 2001 From: barisusakli Date: Thu, 15 Oct 2015 00:43:02 -0400 Subject: [PATCH] check err first --- src/meta/settings.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/meta/settings.js b/src/meta/settings.js index 95661a6dbe..10c987f108 100644 --- a/src/meta/settings.js +++ b/src/meta/settings.js @@ -20,14 +20,16 @@ module.exports = function(Meta) { Meta.settings.set = function(hash, values, callback) { var key = 'settings:' + hash; db.setObject(key, values, function(err) { - if (!err) { - plugins.fireHook('action:settings.set', { - plugin: hash, - settings: values - }); + if (err) { + return callback(err); } - callback.apply(this, arguments); + plugins.fireHook('action:settings.set', { + plugin: hash, + settings: values + }); + + callback(); }); };