From 6d4276853d14418f9bfde8d9707984c3343bb12f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 19 Nov 2021 11:03:58 +0100 Subject: [PATCH] =?utf8?q?get=5Farticle,=20um=20R=C3=BCckgabewert=20erweit?= =?utf8?q?ert,=20falls=20kein=20Produkt=20gefunden=20wurde?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/ShopConnector/Shopware6.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/SL/ShopConnector/Shopware6.pm b/SL/ShopConnector/Shopware6.pm index e065176e8..b9d80ef35 100644 --- a/SL/ShopConnector/Shopware6.pm +++ b/SL/ShopConnector/Shopware6.pm @@ -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}; -- 2.20.1