From 77710b24fa21eb76305af7b3f8befcc2b3d9a6a9 Mon Sep 17 00:00:00 2001 From: Andreas Schempp Date: Tue, 18 Jun 2024 14:04:34 +0200 Subject: [PATCH] Correctly handle empty target value (e.g. for temporary records) --- .../DataContainer/ShortlinkLabelListener.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/EventListener/DataContainer/ShortlinkLabelListener.php b/src/EventListener/DataContainer/ShortlinkLabelListener.php index a50e5cd..a9dc26d 100644 --- a/src/EventListener/DataContainer/ShortlinkLabelListener.php +++ b/src/EventListener/DataContainer/ShortlinkLabelListener.php @@ -39,12 +39,14 @@ public function __invoke(array $row, string $label, DataContainer $dc, array $co break; case 'target': - $targetUrl = $this->generator->generateTargetUrl($row['target']); - $columns[$k] = sprintf( - '%s', - $targetUrl, - $row['name'] ?: $targetUrl, - ); + if ($row['target']) { + $targetUrl = $this->generator->generateTargetUrl($row['target']); + $columns[$k] = sprintf( + '%s', + $targetUrl, + $row['name'] ?: $targetUrl, + ); + } break; case 'log':