Better check (avoid to add invalid results, leading to a crash when adding this invalid item).

Fixes issue 3132, but I would like to improve this in a second step: clicking the provider adding all the songs for this provider to the playlist.
This commit is contained in:
Arnaud Bienner 2014-09-13 21:31:33 +02:00
parent b3f838216f
commit 8be65b8565
1 changed files with 5 additions and 2 deletions

View File

@ -236,8 +236,11 @@ void GlobalSearchModel::GetChildResults(
GetChildResults(itemFromIndex(index), results, visited);
}
} else {
// No - it's a song, add its result
results->append(item->data(Role_Result).value<SearchProvider::Result>());
// No - maybe it's a song, add its result if valid
QVariant result = item->data(Role_Result);
if (result.isValid()) {
results->append(result.value<SearchProvider::Result>());
}
}
}