From a2027845ad34efd8f485278d65d13bb85b3e0810 Mon Sep 17 00:00:00 2001 From: Nima Gardideh Date: Mon, 17 Dec 2012 13:07:22 -0500 Subject: [PATCH] Update lib/google_custom_search_api.rb MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In some cases, `queries' is not a key of the result – causing a crash! --- lib/google_custom_search_api.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/google_custom_search_api.rb b/lib/google_custom_search_api.rb index 7c01ee7..136230b 100644 --- a/lib/google_custom_search_api.rb +++ b/lib/google_custom_search_api.rb @@ -41,7 +41,7 @@ def search_and_return_all_results(query, opts = {}) # results = ResponseData.new(read_search_data("google_poker_#{opts[:start]}")) yield results res << results - if results.queries.keys.include?("nextPage") + if results["queries"] and results.queries.keys.include?("nextPage") opts[:start] = results.queries.nextPage.first.startIndex else opts[:start] = nil