fix for invalid dynamic_cast

after my loplugin-cstylecast commits.
this is a follow on to the bug reported in fdo#84608

Change-Id: Icc4f4baf3690e939c07a71a949200270bf1f4614