1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-13 09:34:53 +02:00

Do not try to access NULL-pointers instead search the whole hash for holes

This commit is contained in:
Uwe L. Korn
2013-06-10 17:36:22 +02:00
committed by Michael Zanetti
parent 980f56dbcf
commit d800323afe

View File

@@ -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 );
}
}
}
}