Branch: master

456dc48a 2014-05-22 20:07:19 Slávek Banko
Fix potential null pointer dereference
M src/tools/qstring.cpp
diff --git a/src/tools/qstring.cpp b/src/tools/qstring.cpp
index 7f246fa..210848c 100644
--- a/src/tools/qstring.cpp
+++ b/src/tools/qstring.cpp
@@ -1513,7 +1513,7 @@
 QString::QString( const QString &s ) :
     d(s.d)
 {
-    if (d != shared_null) {
+    if ( d && (d != shared_null) ) {
 #if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
         d->mutex->lock();
 #endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE
@@ -1765,7 +1765,7 @@
 */
 QString &QString::operator=( const QString &s )
 {
-    if (s.d != shared_null) {
+    if ( s.d && (s.d != shared_null) ) {
 #if defined(QT_THREAD_SUPPORT) && defined(MAKE_QSTRING_THREAD_SAFE)
         s.d->mutex->lock();
 #endif // QT_THREAD_SUPPORT && MAKE_QSTRING_THREAD_SAFE