From 0dd7d1e0e069390526a1334ae08f384b5b7a6414 Mon Sep 17 00:00:00 2001 From: Christian Muehlhaeuser Date: Mon, 10 Jan 2011 12:00:52 +0100 Subject: [PATCH] * Fixed using resolv-hints for offline sources. --- .../database/databasecommand_resolve.cpp | 15 +++++++++++---- src/libtomahawk/database/databaseimpl.cpp | 5 ++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/libtomahawk/database/databasecommand_resolve.cpp b/src/libtomahawk/database/databasecommand_resolve.cpp index 394e449c8..3434d43eb 100644 --- a/src/libtomahawk/database/databasecommand_resolve.cpp +++ b/src/libtomahawk/database/databasecommand_resolve.cpp @@ -37,14 +37,21 @@ DatabaseCommand_Resolve::exec( DatabaseImpl* lib ) if ( !m.isEmpty() ) { if ( m.value( "srcid" ).toUInt() > 0 ) - coll = SourceList::instance()->get( m.value( "srcid" ).toUInt() )->collection(); + { + source_ptr s = SourceList::instance()->get( m.value( "srcid" ).toUInt() ); + if ( !s.isNull() ) + coll = s->collection(); + } else coll = SourceList::instance()->getLocal()->collection(); - res << Tomahawk::result_ptr( new Tomahawk::Result( m, coll ) ); - emit results( qid, res ); + if ( !coll.isNull() ) + { + res << Tomahawk::result_ptr( new Tomahawk::Result( m, coll ) ); + emit results( qid, res ); - return; + return; + } } } diff --git a/src/libtomahawk/database/databaseimpl.cpp b/src/libtomahawk/database/databaseimpl.cpp index df6e55f7e..e23b9f9db 100644 --- a/src/libtomahawk/database/databaseimpl.cpp +++ b/src/libtomahawk/database/databaseimpl.cpp @@ -477,6 +477,7 @@ DatabaseImpl::result( const QString& url ) { TomahawkSqlQuery query = newquery(); Tomahawk::source_ptr s; + QVariantMap m; QString fileUrl; if ( url.contains( "servent://" ) ) @@ -484,6 +485,9 @@ DatabaseImpl::result( const QString& url ) QStringList parts = url.mid( QString( "servent://" ).length() ).split( "\t" ); s = SourceList::instance()->get( parts.at( 0 ) ); fileUrl = parts.at( 1 ); + + if ( s.isNull() ) + return m; } else if ( url.contains( "file://" ) ) { @@ -518,7 +522,6 @@ DatabaseImpl::result( const QString& url ) query.bindValue( 0, fileUrl ); query.exec(); - QVariantMap m; if( query.next() ) { const QString url_str = query.value( 0 ).toString();