[interchange] Avoid warning when item_price is called with a SKU rather than hashref

Jon Jensen <[email protected]> Fri, 29 Apr 2016 03:03:49 +0000
Newsgroups gmane.comp.web.interchange.cvs
Message-ID <[email protected]>
commit a19a8b5e3abe9346c7bf593355f35af9c34adb03
Author: Jon Jensen <[email protected]>
Date:   Thu Apr 28 00:50:04 2016 -0600

    Avoid warning when item_price is called with a SKU rather than hashref
    
    Originally from a private repository commit:
    
    Author: Jeff Boes <[email protected]>
    Date:   Wed Mar 24 09:20:20 2010 -0400
    
        This adds a minor sanity check to the code to avoid a warning when
        $item is not a reference (i.e., has been passed in as a SKU).

 lib/Vend/Data.pm |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/lib/Vend/Data.pm b/lib/Vend/Data.pm
index 1df484b..f8c97f9 100644
--- a/lib/Vend/Data.pm
+++ b/lib/Vend/Data.pm
@@ -1,6 +1,6 @@
 # Vend::Data - Interchange databases
 #
-# Copyright (C) 2002-2009 Interchange Development Group
+# Copyright (C) 2002-2016 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
 #
 # This program was originally based on Vend 0.2 and 0.3
@@ -1641,7 +1641,7 @@ sub item_price {
 #::logDebug("item_price initial call: " . (ref $item ? $item->{code} : $item));
 
 	return $item->{mv_cache_price}
-		if ! $quantity and defined $item->{mv_cache_price};
+		if ! $quantity and ref($item) and defined $item->{mv_cache_price};
 
 	$item = { 'code' => $item } unless ref $item;
 	$item->{quantity} = 1 if ! defined $item->{quantity};