coverity#704999 Unchecked dynamic_cast

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