# HG changeset patch # User William Pitcock # Date 1202896481 21600 # Node ID 3ff4aef1e401085778b3185d6dac949216d9a258 # Parent dce2504b5318d1102309ca56d18502ff5af0e35a playlist_compare_artist(): Avoid NULL dereferences. (Bugzilla #172, Bugzilla #168, Bugzilla #35). diff -r dce2504b5318 -r 3ff4aef1e401 src/audacious/playlist.c --- a/src/audacious/playlist.c Tue Feb 12 02:24:22 2008 -0600 +++ b/src/audacious/playlist.c Wed Feb 13 03:54:41 2008 -0600 @@ -2062,6 +2062,7 @@ if (a->tuple != NULL) a_title = tuple_get_string(a->tuple, FIELD_TITLE, NULL); + if (b->tuple != NULL) b_title = tuple_get_string(b->tuple, FIELD_TITLE, NULL); @@ -2091,12 +2092,20 @@ if (a->tuple != NULL) { a_artist = tuple_get_string(a->tuple, FIELD_ARTIST, NULL); + + if (a_artist == NULL) + return 0; + if (str_has_prefix_nocase(a_artist, "the ")) a_artist += 4; } if (b->tuple != NULL) { b_artist = tuple_get_string(b->tuple, FIELD_ARTIST, NULL); + + if (b_artist == NULL) + return 0; + if (str_has_prefix_nocase(b_artist, "the ")) b_artist += 4; }