Fix potential null pointer dereference

pull/2/head
Slávek Banko 10 years ago
parent 3d29992e94
commit 456dc48a97

@ -1513,7 +1513,7 @@ QString::QString( QChar ch )
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 @@ void QStringData::deleteSelf()
*/
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

Loading…
Cancel
Save