fix problem with m4p files crashing sorting

This commit is contained in:
David W. Berry 2004-06-22 01:52:26 +00:00
parent 9492a64846
commit 0ba13be4be

View File

@ -787,11 +787,21 @@ void db_freefile(MP3FILE *pmp3) {
* this should be done quickly, as we'll be holding
* a reader lock on the db
*/
static int nullstrcmp(const char* a, const char* b)
{
if(a == 0)
return b == 0 ? 1 : 0;
if(b == 0)
return -1;
return strcmp(a, b);
}
int compare(MP3RECORD* a, MP3RECORD* b)
{
int comp;
if((comp = strcmp(a->mp3file.album, b->mp3file.album)) != 0)
if((comp = nullstrcmp(a->mp3file.album, b->mp3file.album)) != 0)
return comp;
if((comp = (a->mp3file.disc - b->mp3file.disc)) != 0)