<commit_before>Spree::ShippingMethod.class_eval do
  attr_accessible :discount

  def compute_amount(calculable)
    self.calculator.compute(calculable) * (100 - (self.discount || 0))/100.0
  end
end<commit_msg>Avoid weird bug triggered when users deleted all items in cart<commit_after>Spree::ShippingMethod.class_eval do
  attr_accessible :discount

  def compute_amount(calculable)
    self.calculator.compute(calculable) * (100 - (self.discount || 0))/100.0 rescue nil
  end
end
{'fraction_non_alphanumeric': 0.0995850622406639, 'fraction_numerical': 0.03319502074688797, 'mean_word_length': 5.2727272727272725, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '404604', 'n_tokens_mistral': 174, 'n_tokens_neox': 155, 'n_words': 35}