From d2883181a38608b5fc8d86001da196eef8d69d8f Mon Sep 17 00:00:00 2001 From: ville Date: Sun, 9 Oct 2005 15:18:07 +0000 Subject: Avoid crash with files that don't have a id3v2 tag. git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@881 e10066b5-e1e2-0310-b819-94efdf66514b --- mg_image_provider.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/mg_image_provider.c b/mg_image_provider.c index a9418f3..c2500e7 100644 --- a/mg_image_provider.c +++ b/mg_image_provider.c @@ -310,22 +310,33 @@ string mgImageProvider::extractImagesFromTag( string f ) if( !strcasecmp(extension(filename), "flac") ) { TagLib::FLAC::File f(filename); - l = f.ID3v2Tag()->frameListMap()["APIC"]; - dir = treatFrameList( l, image_cache ); + if (f.ID3v2Tag()) + { + l = f.ID3v2Tag()->frameListMap()["APIC"]; + dir = treatFrameList( l, image_cache ); + } } else if( !strcasecmp(extension(filename), "mp3") ) { TagLib::MPEG::File f(filename); - l = f.ID3v2Tag()->frameListMap()["APIC"]; - dir = treatFrameList( l, image_cache ); + if (f.ID3v2Tag()) + { + l = f.ID3v2Tag()->frameListMap()["APIC"]; + dir = treatFrameList( l, image_cache ); + } } else if( !strcasecmp(extension(filename), "ogg") ) { // what to do here? TagLib::Vorbis::File f(filename); - // l = f.ID3v2Tag()->frameListMap()["APIC"]; - // dir = treatFrameList( l, image_cache ); + /* + if (f.ID3v2Tag()) + { + l = f.ID3v2Tag()->frameListMap()["APIC"]; + dir = treatFrameList( l, image_cache ); + } + */ } // returns empty if no images were found in tags -- cgit v1.2.3