From 7b43b73f586d785c8cbf7372b05feb1084e933ca Mon Sep 17 00:00:00 2001 From: reaper Date: Wed, 5 Jan 2011 14:57:43 +0900 Subject: [PATCH] Fixed a bug where credits being nil would throw an error. --- lib/spree/paypal_express.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/spree/paypal_express.rb b/lib/spree/paypal_express.rb index 6823461..e4da911 100644 --- a/lib/spree/paypal_express.rb +++ b/lib/spree/paypal_express.rb @@ -237,8 +237,12 @@ module Spree::PaypalExpress :amount => (credit.amount*100).to_i } end end - items.concat credits.compact! - credits_total = credits.map {|i| i[:amount] * i[:qty] }.sum + + credits_total = 0 + if credits.respond_to? :compact + items.concat credits.compact! + credits_total = credits.map {|i| i[:amount] * i[:qty] }.sum + end opts = { :return_url => request.protocol + request.host_with_port + "/orders/#{order.number}/checkout/paypal_confirm?payment_method_id=#{payment_method}", :cancel_return_url => "http://" + request.host_with_port + "/orders/#{order.number}/edit",