diff --git a/src/base_object-inl.h b/src/base_object-inl.h index c9b4e1491fc947..fc2611444c1af4 100644 --- a/src/base_object-inl.h +++ b/src/base_object-inl.h @@ -234,13 +234,13 @@ BaseObject* BaseObjectPtrImpl::get_base_object() const { template BaseObjectPtrImpl::~BaseObjectPtrImpl() { - if (get() == nullptr) return; if (kIsWeak) { - if (--pointer_data()->weak_ptr_count == 0 && + if (pointer_data() != nullptr && + --pointer_data()->weak_ptr_count == 0 && pointer_data()->self == nullptr) { delete pointer_data(); } - } else { + } else if (get() != nullptr) { get()->decrease_refcount(); } }