coverity#705969 Dereference before null check

Change-Id: Icb19931bb529e6c2b98621a603cdb86011d68a9e
(cherry picked from commit 51452b7afe858139076010decbe04758321a8396)
Reviewed-on: https://gerrit.libreoffice.org/8732
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>