Permalink
Browse files

[fix] fix uncaught error when a view does not return `rows`.

  • Loading branch information...
1 parent 7f387ee commit 8ebd01f083e75fbb2f6ad2bc981f911a0a85310c @chjj chjj committed Feb 10, 2013
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/resourceful/engines/couchdb/index.js
@@ -172,7 +172,7 @@ Couchdb.prototype.view = function (path, opts, callback) {
return this.request.call(this, 'view', path, opts, function (e, res) {
if (e) return callback(e);
- callback(null, res.rows.map(function (r) {
+ callback(null, (res.rows || []).map(function (r) {
// With `include_docs=true`, the 'doc' attribute is set instead of 'value'.
if (r.doc) {
if (r.doc._id) {

0 comments on commit 8ebd01f

Please sign in to comment.