diff options
-rw-r--r-- | src/network/kernel/qhostinfo.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index b3d6844e43..fbc3248815 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -609,10 +609,11 @@ QHostInfo::QHostInfo(const QHostInfo &other) */ QHostInfo &QHostInfo::operator=(const QHostInfo &other) { - if (d_ptr) - *d_ptr = *other.d_ptr; - else - d_ptr = new QHostInfoPrivate(*other.d_ptr); + if (this == &other) + return *this; + + Q_ASSERT(d_ptr && other.d_ptr); + *d_ptr = *other.d_ptr; return *this; } |