fdo#77242 fix crash

Change-Id: Ic28b2dccc02627446a794929fe970495b15eb0e1
Reviewed-on: https://gerrit.libreoffice.org/9154
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>