lib/mailarchiva/soap_client.rb in mailarchiva-0.0.1 vs lib/mailarchiva/soap_client.rb in mailarchiva-0.0.2
- old
+ new
@@ -26,10 +26,10 @@
def search_results_from_response(response)
return [] if search_result_size == 0
search_results_response = soap_client.call(:get_search_results, message: { blob_category: 'email', start: 1, end: search_result_size })
search_results = search_results_response.body[:get_search_results_response][:return]
- search_results.map{|field_values| Message.new(field_values)}
+ search_results.nil? ? [] : search_results.map{|field_values| Message.new(field_values)}
end
def search_result_size
search_result_size_response = soap_client.call(:get_search_result_size)
search_result_size_response.body[:get_search_result_size_response][:return].to_i
\ No newline at end of file