From 142989a80d84d5712311f48c2afd160e34f06f20 Mon Sep 17 00:00:00 2001 From: Arnaud Berthomier Date: Mon, 13 Jul 2009 17:58:48 +0800 Subject: [PATCH] Dont die on empty results Signed-off-by: Matt Aimonetti --- lib/couchrest/mixins/collection.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/couchrest/mixins/collection.rb b/lib/couchrest/mixins/collection.rb index 3af8d74..b492dbe 100644 --- a/lib/couchrest/mixins/collection.rb +++ b/lib/couchrest/mixins/collection.rb @@ -209,12 +209,14 @@ module CouchRest def remember_where_we_left_off(results, page) last_row = results['rows'].last - @last_key = last_row['key'] - @last_docid = last_row['id'] + if last_row + @last_key = last_row['key'] + @last_docid = last_row['id'] + end @last_page = page end end end end -end \ No newline at end of file +end