Skip to content

Commit

Permalink
Fix fields shoud not be added if empty refs Icinga#2945
Browse files Browse the repository at this point in the history
  • Loading branch information
moreamazingnick authored Jan 3, 2025
1 parent de8fe10 commit afedf61
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion library/Director/Data/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,10 @@ protected function exportIcingaObject(IcingaObject $object)
{
$props = (array) $object->toPlainObject($this->resolveObjects, !$this->showDefaults);
if ($object->supportsFields()) {
$props['fields'] = $this->fieldReferenceLoader->loadFor($object);
$fields = $this->fieldReferenceLoader->loadFor($object);
if (count($fields) > 0) {
$props['fields'] = $fields;
}
}

return $props;
Expand Down

0 comments on commit afedf61

Please sign in to comment.