1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-02-25 20:33:20 +01:00

We have introduced a third valid state but did not add the check for it.

This commit is contained in:
Uwe L. Korn 2013-09-18 19:31:21 +02:00
parent 16c5bbee85
commit abbc6eefc3

View File

@ -94,15 +94,17 @@ SipInfo::clear()
bool
SipInfo::isValid() const
{
// tDebug() << Q_FUNC_INFO << d->visible << d->host << d->port << d->nodeId << d->key;
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << d->visible << d->host << d->port << d->nodeId << d->key;
if ( !d->visible.isNull() )
{
if (
// visible and all data available
( d->visible.toBool() && !d->host.isEmpty() && ( d->port > 0 ) && !d->nodeId.isNull() && !d->key.isNull() )
// invisible and no data available
|| ( !d->visible.toBool() && d->host.isEmpty() && ( d->port < 0 ) && d->nodeId.isNull() && d->key.isNull() )
)
// visible and all data available
if ( d->visible.toBool() && !d->host.isEmpty() && ( d->port > 0 ) && !d->nodeId.isNull() && !d->key.isNull() )
return true;
// invisible and no data available
if ( !d->visible.toBool() && d->host.isEmpty() && ( d->port < 0 ) && d->nodeId.isNull() && d->key.isNull() )
return true;
// invisible and but nodeId and key available
if ( !d->visible.toBool() && d->host.isEmpty() && ( d->port < 0 ) && !d->nodeId.isNull() && !d->key.isNull() )
return true;
}