From b30d23d27839a2a360a4edd2d0fe17961e221135 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Sun, 12 Feb 2023 00:54:38 +0300 Subject: [PATCH] vcmi: make ConstTransitivePtr always init self. --- lib/ConstTransitivePtr.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/ConstTransitivePtr.h b/lib/ConstTransitivePtr.h index 3fccbc554..9867bf65e 100644 --- a/lib/ConstTransitivePtr.h +++ b/lib/ConstTransitivePtr.h @@ -16,7 +16,7 @@ VCMI_LIB_NAMESPACE_BEGIN template class ConstTransitivePtr { - T *ptr; + T *ptr = nullptr; ConstTransitivePtr(const T *Ptr) : ptr(const_cast(Ptr)) {} @@ -25,10 +25,7 @@ public: : ptr(Ptr) {} ConstTransitivePtr(std::nullptr_t) - : ptr(nullptr) {} - - const T& operator*() const { return *ptr;