Skip to content

Commit 39542c7

Browse files
committed
failsafe source_obj check
1 parent 14d74e3 commit 39542c7

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

collective/behavior/relatedmedia/browser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ def __call__(self):
336336

337337
source_obj = relation.from_object
338338

339-
if filter_keyword and not match:
339+
if source_obj and filter_keyword and not match:
340340
# check if source or target matches the filter keyword
341341
match = (
342342
filter_keyword in source_obj.title_or_id().lower()
@@ -351,8 +351,8 @@ def __call__(self):
351351
url=obj.absolute_url_path(),
352352
),
353353
target=dict(
354-
title=source_obj.title_or_id(),
355-
url=source_obj.absolute_url_path(),
354+
title=source_obj.title_or_id() if source_obj else "-broken-",
355+
url=source_obj.absolute_url_path() if source_obj else "#",
356356
),
357357
)
358358
)

0 commit comments

Comments
 (0)