[wellwell-devel] [wellwell] Fall back to an empty array when user doesn't have a database cart.

Stefan Hornburg wellwell-devel at rt.icdevgroup.org
Thu Jul 1 11:04:07 UTC 2010


commit 1f7d28e75ca90c314d9f14c37ff05906d4e92d2c
Author: Stefan Hornburg (Racke) <racke at linuxia.de>
Date:   Thu Jul 1 13:03:33 2010 +0200

    Fall back to an empty array when user doesn't have a database cart.

 lib/WellWell/DatabaseCart.pm |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/lib/WellWell/DatabaseCart.pm b/lib/WellWell/DatabaseCart.pm
index 2717dd7..4ee4d68 100644
--- a/lib/WellWell/DatabaseCart.pm
+++ b/lib/WellWell/DatabaseCart.pm
@@ -82,8 +82,14 @@ sub cart_compare {
 	my ($cart, $cart_products, $session_products, $cart_item, $session_item, $max_count, @diff);
 	
 	$cart = get_cart_by_name($Vend::Cfg->{DatabaseCart}, 'cart', $Vend::Session->{username});
+
+	if ($cart) {
+		$cart_products = $cart->item_list();
+	}
+	else {
+		$cart_products = [];
+	}
 	
-	$cart_products = $cart->item_list();
 	$session_products = $Vend::Items;
 
 	if (@$cart_products > @$session_products) {



More information about the wellwell-devel mailing list