diff --git a/cint/reflex/src/ScopeBase.cxx b/cint/reflex/src/ScopeBase.cxx
index 4706bdf1cb97f54fa5291de4f91d4d43233116a1..83ed45a74c9ba32661d925c01bcd180e5dd8c4bf 100644
--- a/cint/reflex/src/ScopeBase.cxx
+++ b/cint/reflex/src/ScopeBase.cxx
@@ -151,7 +151,11 @@ Reflex::Type() const {
    case TYPETEMPLATEINSTANCE:
    case UNION:
    case ENUM:
-      return (dynamic_cast<const TypeBase*>(this))->ThisType();
+      {
+         const TypeBase* tb = dynamic_cast<const TypeBase*>(this);
+         if (!tb) return Dummy::Type();
+         return tb->ThisType();
+      }
    default:
       return Dummy::Type();
    }