Skip to content

Commit

Permalink
Added guard condition for case when order.packages is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
romul committed Jul 10, 2014
1 parent a4468d3 commit 5bcc232
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/controllers/orders_controller_decorator.rb
Expand Up @@ -16,8 +16,7 @@ def estimate_shipping_cost

@order.ship_address = Spree::Address.new(address_attrs)
package = Spree::Stock::Coordinator.new(@order).packages.first
@shipping_rates = package.shipping_rates
#@shipping_rates = Spree::Stock::Estimator.new(@order).shipping_rates(package)
@shipping_rates = package ? package.shipping_rates : []
@esc_values = @shipping_rates.map do |sr|
error = nil
begin
Expand Down

0 comments on commit 5bcc232

Please sign in to comment.