Don't `dynamic_cast` twice.