From 8be65b85654ed0afb1bc085f363b6b2f83656335 Mon Sep 17 00:00:00 2001 From: Arnaud Bienner Date: Sat, 13 Sep 2014 21:31:33 +0200 Subject: [PATCH] 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. --- src/globalsearch/globalsearchmodel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/globalsearch/globalsearchmodel.cpp b/src/globalsearch/globalsearchmodel.cpp index 0ff0b4655..c5b381fe3 100644 --- a/src/globalsearch/globalsearchmodel.cpp +++ b/src/globalsearch/globalsearchmodel.cpp @@ -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()); + // No - maybe it's a song, add its result if valid + QVariant result = item->data(Role_Result); + if (result.isValid()) { + results->append(result.value()); + } } }