[musicdb] fix: unchecked access to albumartists/artists causes us to crash when they...
authornight199uk <night199uk@xbmc.org>
Fri, 3 May 2013 19:39:48 +0000 (03:39 +0800)
committernight199uk <night199uk@xbmc.org>
Fri, 3 May 2013 19:39:48 +0000 (03:39 +0800)
xbmc/music/infoscanner/MusicInfoScanner.cpp

index 30f0bc0..7516426 100644 (file)
@@ -519,7 +519,7 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album
       for (vector<string>::const_iterator it = tag.GetMusicBrainzArtistID().begin(); it != tag.GetMusicBrainzArtistID().end(); ++it)
       {
         CStdString strJoinPhrase = (it == --tag.GetMusicBrainzArtistID().end() ? "" : g_advancedSettings.m_musicItemSeparator);
-        CArtistCredit mbartist(song.artist[0], *it, strJoinPhrase);
+        CArtistCredit mbartist(tag.GetArtist().empty() ? "" : tag.GetArtist()[0], *it, strJoinPhrase);
         song.artistCredits.push_back(mbartist);
       }
       song.artist = tag.GetArtist();
@@ -553,7 +553,7 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album
         {
           // Picard always stored the display artist string in the first artist slot, no need to split it
           CStdString strJoinPhrase = (it == --tag.GetMusicBrainzAlbumArtistID().end() ? "" : g_advancedSettings.m_musicItemSeparator);
-          CArtistCredit mbartist(tag.GetAlbumArtist()[0], *it, strJoinPhrase);
+          CArtistCredit mbartist(tag.GetAlbumArtist().empty() ? "" : tag.GetAlbumArtist()[0], *it, strJoinPhrase);
           album.artistCredits.push_back(mbartist);
         }
         album.artist = tag.GetAlbumArtist();