Skip to content

Commit 84c97e0

Browse files
committed
OS2FORMS-358 handling empty response
1 parent 85dec05 commit 84c97e0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Plugin/os2web/DataLookup/DatafordelerCVR.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function lookup($cvr) {
7474
}
7575

7676
$cvrResult = new CompanyLookupResult();
77-
if ($result && isset($result->virksomhed) && !empty($result->virksomhed)) {
77+
if ($result && isset($result->virksomhed) && !empty((array) $result->virksomhed)) {
7878
$cvrResult->setSuccessful();
7979
$cvrResult->setCvr($cvr);
8080

src/Plugin/os2web/DataLookup/DatafordelerPNumber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ public function lookup($param) {
7474
}
7575

7676
$cvrResult = new CompanyLookupResult();
77-
if ($result && isset($result->produktionsenhed) && !empty($result->produktionsenhed)) {
77+
if ($result && isset($result->produktionsenhed) && !empty((array) $result->produktionsenhed)) {
7878
$cvrResult->setSuccessful();
79-
$cvrResult->setCvr($result->produktionsenhed->tilknyttetVirksomhedsCVRNummer);
79+
$cvrResult->setCvr($result->produktionsenhed->tilknyttetVirksomhedsCVRNummer ?? '');
8080

8181
if ($result->produktionsenhedsnavn) {
8282
$cvrResult->setName($result->produktionsenhedsnavn->vaerdi);

0 commit comments

Comments
 (0)