Fix bugs when trying to handle a Sku that no longer exists in the db.

This commit is contained in:
Colin Kuskie 2009-04-02 21:28:41 +00:00
parent 118ebf679e
commit 6bd159bcfd

View file

@ -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;
}