didit-tech/FastLegS — pull request #33 by pvencill (2012-04-11 17:53:51+00:00)
Title: Fixes a null result object in the update method of Base

Base.js defines the update method as follows:

Base.prototype.update = function(selector, obj, callback) {
var self = this;

var updateQuery = function() {
var outValues = [];
var updateStatement = Statements.update(self, selector, obj, outValues);
self.client.emit('query', updateStatement, outValues, function(err, result) {
callback(err, result.rowCount);
});
};

loadSchema(self, updateQuery);
};

This breaks if the query has an error (which is paired with a null result), due to rowCount being called on a null object.

Updated code to define result if it doesn't already exist:

result = result || {rowCount:0};