Author: hansbak
Date: Tue Dec 13 09:22:48 2011
New Revision: 1213623
URL:
http://svn.apache.org/viewvc?rev=1213623&view=revLog:
orderitemattributes when empty caused a null pointer exception
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1213623&r1=1213622&r2=1213623&view=diff==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java Tue Dec 13 09:22:48 2011
@@ -20,6 +20,7 @@ package org.ofbiz.order.shoppingcart;
import javolution.util.FastList;
import javolution.util.FastMap;
+
import org.ofbiz.base.util.*;
import org.ofbiz.entity.Delegator;
import org.ofbiz.entity.DelegatorFactory;
@@ -575,8 +576,10 @@ public class ShoppingCart implements Ite
this, Boolean.TRUE, Boolean.TRUE, parentProductId, Boolean.FALSE, Boolean.FALSE);
}
// add order item attributes
- for (Entry<String, String> entry : orderItemAttributes.entrySet()) {
- item.setOrderItemAttribute(entry.getKey(), entry.getValue());
+ if (UtilValidate.isNotEmpty(orderItemAttributes)) {
+ for (Entry<String, String> entry : orderItemAttributes.entrySet()) {
+ item.setOrderItemAttribute(entry.getKey(), entry.getValue());
+ }
}
return this.addItem(0, item);