diff --git a/include/verilated_types.h b/include/verilated_types.h index 0a92725a9e..54d652f70c 100644 --- a/include/verilated_types.h +++ b/include/verilated_types.h @@ -1685,6 +1685,10 @@ class VlClassRef final { template static inline bool VL_CAST_DYNAMIC(VlClassRef in, VlClassRef& outr) { + if (!in) { + outr = VlNull{}; + return true; + } VlClassRef casted = in.template dynamicCast(); if (VL_LIKELY(casted)) { outr = casted;