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:
committed by
Michael Zanetti
parent
980f56dbcf
commit
d800323afe
@@ -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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user