From d800323afe18ad65f1a2ddfeef69677f9bb50947 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Mon, 10 Jun 2013 17:36:22 +0200 Subject: [PATCH] Do not try to access NULL-pointers instead search the whole hash for holes --- src/libtomahawk/sip/WeakPeerHash.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/libtomahawk/sip/WeakPeerHash.cpp b/src/libtomahawk/sip/WeakPeerHash.cpp index 7f1dcae3a..81b698fd8 100644 --- a/src/libtomahawk/sip/WeakPeerHash.cpp +++ b/src/libtomahawk/sip/WeakPeerHash.cpp @@ -52,6 +52,20 @@ WeakPeerHash::hash() void WeakPeerHash::remove( QObject *value ) { - const QString key = value->property( WEAKPEERHASH_KEY ).toString(); - d_func()->hash.remove( key ); + if ( value ) + { + const QString key = value->property( WEAKPEERHASH_KEY ).toString(); + d_func()->hash.remove( key ); + } + else + { + // Scan for null-Pointers + foreach ( QString key, d_func()->hash.keys() ) + { + if ( d_func()->hash.value( key ).isNull() ) + { + d_func()->hash.remove( key ); + } + } + } }