changeset 4284:3ff4aef1e401

playlist_compare_artist(): Avoid NULL dereferences. (Bugzilla #172, Bugzilla #168, Bugzilla #35).
author William Pitcock <nenolod@atheme.org>
date Wed, 13 Feb 2008 03:54:41 -0600
parents dce2504b5318
children 314c972f2060
files src/audacious/playlist.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;
     }