From 6bd159bcfda8218cb00d4959e1eb0c31decb9cf2 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Thu, 2 Apr 2009 21:28:41 +0000 Subject: [PATCH] Fix bugs when trying to handle a Sku that no longer exists in the db. --- lib/WebGUI/Shop/CartItem.pm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/WebGUI/Shop/CartItem.pm b/lib/WebGUI/Shop/CartItem.pm index ab662d8b5..60af3d25a 100644 --- a/lib/WebGUI/Shop/CartItem.pm +++ b/lib/WebGUI/Shop/CartItem.pm @@ -175,7 +175,7 @@ sub getSku { my ($self) = @_; my $asset = ''; $asset = WebGUI::Asset->newByDynamicClass($self->cart->session, $self->get("assetId")); - $asset->applyOptions($self->get("options")); + $asset->applyOptions($self->get("options")) if $asset; return $asset; } @@ -229,7 +229,8 @@ Removes this item from the cart and calls $sku->onRemoveFromCart. See also delet sub remove { my $self = shift; - $self->getSku->onRemoveFromCart($self); + my $sku = $self->getSku; + $sku->onRemoveFromCart($self) if $sku; return $self->delete; }