diff --git a/src/LookupResult/CompanyLookupResult.php b/src/LookupResult/CompanyLookupResult.php index cf21e9e..1ab4ef0 100644 --- a/src/LookupResult/CompanyLookupResult.php +++ b/src/LookupResult/CompanyLookupResult.php @@ -352,7 +352,7 @@ public function setAddress(string $address): void { * The field value or the empty string if the field does not exist. */ public function getFieldValue(string $field): mixed { - if (property_exists($this, $field)) { + if (property_exists($this, $field) && isset($this->{$field})) { return $this->{$field}; } diff --git a/src/LookupResult/CprLookupResult.php b/src/LookupResult/CprLookupResult.php index 1b9f67c..0b254d3 100644 --- a/src/LookupResult/CprLookupResult.php +++ b/src/LookupResult/CprLookupResult.php @@ -672,7 +672,7 @@ public function hasGuardian(string $cpr): bool { * The value of the field or the empty string. */ public function getFieldValue(string $field): mixed { - if (property_exists($this, $field)) { + if (property_exists($this, $field) && isset($this->{$field})) { return $this->{$field}; }