1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:07:45 +00:00

AK: Fix NonnullRefPtr<T>::operator=(NonnullRefPtr<U>).

This commit is contained in:
Andreas Kling 2019-07-26 08:04:33 +02:00
parent d6cd98cfa1
commit fc9a1a1328

View file

@ -102,7 +102,7 @@ public:
template<typename U> template<typename U>
NonnullRefPtr& operator=(const NonnullRefPtr<U>& other) NonnullRefPtr& operator=(const NonnullRefPtr<U>& other)
{ {
if (m_ptr != other.m_ptr) { if (m_ptr != other.ptr()) {
deref_if_not_null(m_ptr); deref_if_not_null(m_ptr);
m_ptr = const_cast<T*>(static_cast<const T*>(other.ptr())); m_ptr = const_cast<T*>(static_cast<const T*>(other.ptr()));
m_ptr->ref(); m_ptr->ref();