coverity#1194911 Unchecked dynamic_cast

Change-Id: I1e7f4bcd8f54219d86ad7a003469d5a486090f47
(cherry picked from commit 8736c5222a8e83a1310713a92492e63198749467)
Reviewed-on: https://gerrit.libreoffice.org/10630
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>