get_article, um Rückgabewert erweitert, falls kein Produkt gefunden wurde
[kivitendo-erp.git] / SL / ShopConnector / Shopware6.pm
index e065176..b9d80ef 100644 (file)
@@ -581,6 +581,9 @@ sub get_article {
   } catch {
     die "Malformed JSON Data: $_ " . $ret->responseContent();
   };
+
+  # maybe no product was found ...
+  return undef unless scalar @{ $data_json->{data} } > 0;
   # caller wants this structure:
   # $stock_onlineshop = $shop_article->{data}->{mainDetail}->{inStock};
   # $active_online = $shop_article->{data}->{active};