Skip to content

Commit

Permalink
return empty array if distributor is blank
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpbrett committed Sep 18, 2020
1 parent 0c688bb commit 7f17ab5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 0 additions & 2 deletions app/helpers/enterprises_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ def current_customer
end

def available_shipping_methods
return [] if current_distributor.blank?

DistributorShippingMethods.shipping_methods(current_distributor, true, current_customer)
end

Expand Down
2 changes: 2 additions & 0 deletions app/services/distributor_shipping_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

class DistributorShippingMethods
def self.shipping_methods(distributor, checkout = false, customer = nil)
return [] if distributor.blank?

methods = if checkout
distributor.shipping_methods.display_on_checkout.to_a
else
Expand Down

0 comments on commit 7f17ab5

Please sign in to comment.