Commit ae1fefc3 authored by Matěj Laitl's avatar Matěj Laitl
Browse files

Daap::Reader: Don't use QList::[ on unreliable input, use ::value()

This should fix bug 280774, but I don't use DAAP collection, do I'm
shooting blindly.

BUGFIXES:
 * Fix crash related to DAAP collection.

Reporters, if this doesn't solve your bug, please reopen.

BUG: 280774
FIXED-IN: 2.6
DIGEST: bugfix
parent fc3d68a9
......@@ -86,6 +86,7 @@ VERSION 2.6-Beta 1
"1.2 GB free" is shown instead of "85% used"; thicker capacity bar.
BUGFIXES:
* Fix crash related to DAAP collection. (BR 280774)
* Fix crash on startup related to Audio CD collection. (BR 256585)
* When turning dynamic playlist on, immediately populate playlist and clear
any possible playlist sorting. (BR 220558)
......
......@@ -116,13 +116,13 @@ Reader::contentCodesReceived( int /* id */, bool error )
QList<QVariant> root = contentCodes["mccr"].toList();
if( root.isEmpty() )
return; //error
root = root[0].toMap()["mdcl"].toList();
root = root[0].toMap().value( "mdcl" ).toList();
foreach( QVariant v, root )
{
Map entry = v.toMap();
QString code = entry["mcnm"].toList()[0].toString();
QString name = entry["mcna"].toList()[0].toString();
ContentTypes type = static_cast< ContentTypes > ( entry["mcty"].toList()[0].toInt() );
QString code = entry.value( "mcnm" ).toList().value( 0 ).toString();
QString name = entry.value( "mcna" ).toList().value( 0 ).toString();
ContentTypes type = ContentTypes( entry.value( "mcty" ).toList().value( 0 ).toInt() );
if( !m_codes.contains( code ) && !code.isEmpty() && type > 0 )
{
m_codes[code] = Code( name, type );
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment