Permalink
Browse files

CVideoInfoTag/CMusicInfoTag: make sure not to overwrite sortable fiel…

…ds with empty values (fixes #13850)
  • Loading branch information...
1 parent 3347f99 commit 756710d000ad0e2517f5c33934399319fcf5cfcb @Montellese Montellese committed Jan 5, 2014
Showing with 24 additions and 3 deletions.
  1. +8 −1 xbmc/music/tags/MusicInfoTag.cpp
  2. +16 −2 xbmc/video/VideoInfoTag.cpp
@@ -592,7 +592,14 @@ void CMusicInfoTag::ToSortable(SortItem& sortable, Field field) const
{
switch (field)
{
- case FieldTitle: sortable[FieldTitle] = m_strTitle; break;
+ case FieldTitle:
+ {
+ // make sure not to overwrite an existing path with an empty one
+ std::string title = m_strTitle;
+ if (!title.empty() || sortable.find(FieldTitle) == sortable.end())
+ sortable[FieldTitle] = title;
+ break;
+ }
case FieldArtist: sortable[FieldArtist] = m_artist; break;
case FieldAlbum: sortable[FieldAlbum] = m_strAlbum; break;
case FieldAlbumArtist: sortable[FieldAlbumArtist] = m_albumArtist; break;
@@ -490,15 +490,29 @@ void CVideoInfoTag::ToSortable(SortItem& sortable, Field field) const
case FieldTagline: sortable[FieldTagline] = m_strTagLine; break;
case FieldPlotOutline: sortable[FieldPlotOutline] = m_strPlotOutline; break;
case FieldPlot: sortable[FieldPlot] = m_strPlot; break;
- case FieldTitle: sortable[FieldTitle] = m_strTitle; break;
+ case FieldTitle:
+ {
+ // make sure not to overwrite an existing path with an empty one
+ std::string title = m_strTitle;
+ if (!title.empty() || sortable.find(FieldTitle) == sortable.end())
+ sortable[FieldTitle] = title;
+ break;
+ }
case FieldVotes: sortable[FieldVotes] = m_strVotes; break;
case FieldStudio: sortable[FieldStudio] = m_studio; break;
case FieldTrailer: sortable[FieldTrailer] = m_strTrailer; break;
case FieldSet: sortable[FieldSet] = m_strSet; break;
case FieldTime: sortable[FieldTime] = GetDuration(); break;
case FieldFilename: sortable[FieldFilename] = m_strFile; break;
case FieldMPAA: sortable[FieldMPAA] = m_strMPAARating; break;
- case FieldPath: sortable[FieldPath] = m_strFileNameAndPath; break;
+ case FieldPath:
+ {
+ // make sure not to overwrite an existing path with an empty one
+ std::string path = GetPath();
+ if (!path.empty() || sortable.find(FieldPath) == sortable.end())
+ sortable[FieldPath] = path;
+ break;
+ }
case FieldSortTitle: sortable[FieldSortTitle] = m_strSortTitle; break;
case FieldTvShowStatus: sortable[FieldTvShowStatus] = m_strStatus; break;
case FieldProductionCode: sortable[FieldProductionCode] = m_strProductionCode; break;

0 comments on commit 756710d

Please sign in to comment.