From 7acb65afa34e7d22f86efd71fb14a5bc13f832c9 Mon Sep 17 00:00:00 2001 From: Jesse Gibson Date: Sat, 20 Feb 2016 23:37:43 -0700 Subject: [PATCH] Fix thrown error in `.set` When passed a primitive value but not a callback, `.set` will try to invoke the callback with the error data, except since it's undefined, it throws. I've added a line that prevents that error, allowing execution to continue with the developer warning. --- gun.js | 1 + 1 file changed, 1 insertion(+) diff --git a/gun.js b/gun.js index 65499909..ced97703 100644 --- a/gun.js +++ b/gun.js @@ -976,6 +976,7 @@ Gun.chain.set = function(item, cb, opt){ var gun = this, ctx = {}, chain; + cb = cb || function(){}; if(!Gun.is(item)){ return cb.call(gun, {err: Gun.log('Set only supports node references currently!')}), gun } // TODO: Bug? Should we return not gun on error? (ctx.chain = item.chain()).back = gun; ctx.chain._ = item._;