Skip to content

Loading…

Don't call the save callback unless it's definitely a function #33

Open
wants to merge 1 commit into from

1 participant

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 2 additions and 2 deletions.
  1. +2 −2 nstore.js
View
4 nstore.js
@@ -125,8 +125,8 @@ var nStore = module.exports = Pattern.extend({
}
this.toWrite[key] = doc;
this.toWriteCallbacks.push(function (err) {
- if (err) callback(err);
- else callback(err, key);
+ if (err && typeof callback == 'function') callback(err);
+ else if (typeof callback == 'function') callback(err, key);
});
this.checkQueue();
},
Something went wrong with that request. Please try again.