Commit 0318fb35 authored by Michael Pyne's avatar Michael Pyne
Browse files

coverinfo: Do not crash if an MP3 file has no ID3 tag.

This rarely happens since taglib will simply create an ID3 tag if one
didn't exist before... but taglib can't do this if it can't find the
file, which now seems to occur for files with a non-UTF8 filename

You see this as a 'Couldn't resolve the mime type of <<foo>> -- this
shouldn't happen' message on the console. In this situation JuK is able
to resolve the file to an appropriate TagLib::File subclass, but the
TagLib object is in an invalid state.

CoverInfo wasn't checking for this (it was assuming any TagLib::File*
that it was given was valid).

I took a look through the reported JuK crasher bugs and didn't see
anything relevant.

I'm not sure whether this will end up in the KDE SC 4.11 or 4.11.1.
parent 85fa729a
......@@ -279,6 +279,11 @@ bool CoverInfo::hasEmbeddedAlbumArt() const
TagLib::ID3v2::Tag *id3tag = mpegFile->ID3v2Tag(false);
if (!id3tag) {
kError() << m_file.absFilePath() << "seems to have invalid ID3 tag";
return false;
// Look for attached picture frames.
TagLib::ID3v2::FrameList frames = id3tag->frameListMap()["APIC"];
return !frames.isEmpty();
Markdown is supported
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