diff --git a/CHANGELOG.md b/CHANGELOG.md index 1984009..30060c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ before starting to add changes. Use example [placed in the end of the page](#exa ## [Unreleased] +- [OS-115] Skipping empty maktrikula objects + ## [3.16.0] 2024-08-27 [#110](https://github.com/OS2Forms/os2forms/pull/110) diff --git a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php index 2083fb1..2ff98b6 100644 --- a/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php +++ b/modules/os2forms_dawa/src/Plugin/os2web/DataLookup/DatafordelerDataLookup.php @@ -91,7 +91,12 @@ public function getMatrikulaEntries(string $matrikulaId) : array { if (NestedArray::keyExists($jsonDecoded, ['features', 0, 'properties', 'jordstykke'])) { $jordstykker = NestedArray::getValue($jsonDecoded, ['features', 0, 'properties', 'jordstykke']); foreach ($jordstykker as $jordstyk) { - $matrikulaEntries[] = new DatafordelerMatrikula($jordstyk); + try { + $matrikulaEntries[] = new DatafordelerMatrikula($jordstyk); + } + catch (\TypeError $e) { + // Could not create matrikula object. + } } } }