Fixing notice when no flat discounts are applied

#1917 While testing this, had forgotten to test it with zero flat discount codes and we ended up with a notice about an invalid argument for a foreach. This should resolve the matter.