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
Notes: sideshowbarker 2024-07-19 13:03:06 +09:00

View file

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