fdo#71043 -  Use STACK lint tool to clean code

The code is using a pointer without check if it is not null.

Change-Id: Icb2dcf8d41a35514e18a5881f59399951b3e0493
Reviewed-on: https://gerrit.libreoffice.org/6529
Tested-by: Caolán McNamara <caolanm@redhat.com>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>