Skip to content

Commit c0a4a48

Browse files
committed
DEVX-640: fixing NullPointerException
1 parent 0efa419 commit c0a4a48

File tree

1 file changed

+2
-2
lines changed
  • commercetools/commercetools-importapi-utils/src/main/java/com/commercetools/sdk

1 file changed

+2
-2
lines changed

commercetools/commercetools-importapi-utils/src/main/java/com/commercetools/sdk/ProductUtil.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121

2222
public final class ProductUtil {
2323

24-
2524
public static ProductDraftImport toProductDraftImport(ProductProjection product) {
2625
var draft = ProductDraftImport.builder().key(product.getKey())
27-
.productType(p -> p.key(product.getProductType().getObj().getKey()))
26+
.productType(p -> p.key(Optional.ofNullable(product.getProductType())
27+
.map( ProductTypeReference::getObj).map(ProductType::getKey).orElse(null)))
2828
.name(l -> l.values(product.getName().values()))
2929
.slug(l -> l.values(product.getSlug().values()))
3030
.description(d -> d.values(

0 commit comments

Comments
 (0)