core/playlists/generic: Initialize pl_random and pl_length
These fields were working fine for statically initialized playlists, but they get set to garbage values when g_malloc()-ing a playlist. Let's make sure they get initialized properly with the rest of the playlist. Fixes #107: Initialize all values in playlist_generic_init() Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
d1c682501f
commit
bb40ef479f
|
@ -42,8 +42,10 @@ void playlist_generic_init(struct playlist *playlist)
|
|||
{
|
||||
if (playlist) {
|
||||
g_queue_init(&playlist->pl_tracks);
|
||||
playlist->pl_sort = NULL;
|
||||
playlist->pl_length = 0;
|
||||
playlist->pl_random = false;
|
||||
playlist->pl_current = NULL;
|
||||
playlist->pl_sort = NULL;
|
||||
playlist->pl_search = NULL;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ void test_user()
|
|||
playlist = playlist_new(PL_USER, "Test Playlist");
|
||||
g_assert_nonnull(playlist);
|
||||
g_assert_cmpuint(playlist->pl_id, ==, 0);
|
||||
g_assert_cmpuint(playlist->pl_length, ==, 0);
|
||||
g_assert_false(playlist->pl_random);
|
||||
|
||||
g_assert_null(playlist_new(PL_USER, "Test Playlist"));
|
||||
g_assert_cmpuint(db->db_size, ==, 1);
|
||||
|
|
Loading…
Reference in New Issue