[BUGFIX] Check if a method exists before calling it

Change-Id: I99abd3b956040cee8339ff90cd7aa792a7e0ad46
Resolves: #58599
Reviewed-on: https://review.typo3.org/29922
Reviewed-by: Jo Hasenau
Tested-by: Jo Hasenau