mirror of
https://github.com/amark/gun.git
synced 2025-06-12 09:06:52 +00:00
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.
This commit is contained in:
parent
f0a7cf1ee9
commit
7acb65afa3
1
gun.js
1
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._;
|
||||
|
Loading…
x
Reference in New Issue
Block a user