From 9e393393e0b5ca1b2c85664b2a5f8e36d199a269 Mon Sep 17 00:00:00 2001 From: "J. Alexander Treuman" Date: Wed, 21 Jun 2006 20:24:43 +0000 Subject: Cleanup getId3Info. git-svn-id: https://svn.musicpd.org/mpd/trunk@4281 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/tag.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/tag.c b/src/tag.c index 126d5bace..aaf9a2d57 100644 --- a/src/tag.c +++ b/src/tag.c @@ -140,24 +140,21 @@ MpdTag * getID3Info(struct id3_tag * tag, char * id, int type, MpdTag * mpdTag) int i; frame = id3_tag_findframe(tag, id, 0); - if(!frame) return mpdTag; + if(!frame || frame->nfields < 2) return mpdTag; field = &frame->fields[1]; nstrings = id3_field_getnstrings(field); for(i = 0; i < nstrings; i++) { ucs4 = id3_field_getstrings(field, i); - assert(ucs4); + if(!ucs4) continue; - if(type == TAG_ITEM_GENRE) { - ucs4 = id3_genre_name(ucs4); - } + if(type == TAG_ITEM_GENRE) ucs4 = id3_genre_name(ucs4); utf8 = id3_ucs4_utf8duplicate(ucs4); - if(!utf8) continue; - if( NULL == mpdTag ) mpdTag = newMpdTag(); + if(mpdTag == NULL) mpdTag = newMpdTag(); addItemToMpdTag(mpdTag, type, utf8); free(utf8); -- cgit v1.2.3