Skip to content

Commit

Permalink
Handle nullptr in dynamic cast
Browse files Browse the repository at this point in the history
Signed-off-by: Ryszard Rozak <[email protected]>
  • Loading branch information
RRozak committed Oct 27, 2023
1 parent 64af831 commit 58b50b7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/verilated_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,10 @@ class VlClassRef final {

template <typename T, typename U>
static inline bool VL_CAST_DYNAMIC(VlClassRef<T> in, VlClassRef<U>& outr) {
if (!in) {
outr = VlNull{};
return true;
}
VlClassRef<U> casted = in.template dynamicCast<U>();
if (VL_LIKELY(casted)) {
outr = casted;
Expand Down

0 comments on commit 58b50b7

Please sign in to comment.