diff --git a/lib/deck.cpp b/lib/deck.cpp index db2c284f..1940643e 100644 --- a/lib/deck.cpp +++ b/lib/deck.cpp @@ -204,8 +204,8 @@ Track *deck :: next() if (!track) track = library :: get_queue()->next(); - - recent_queue.add(track); + if (track) + recent_queue.add(track); return track; } diff --git a/tests/deck.cpp b/tests/deck.cpp index 21f82b14..7057ac7c 100644 --- a/tests/deck.cpp +++ b/tests/deck.cpp @@ -15,7 +15,13 @@ static void test_init() File f("deck", 0); std::list::iterator it; + test_equal(deck :: next(), TRACK_NULL); + + test :: cp_data_dir(); + tagdb :: init(); + library :: init(); deck :: init(); + test_equal(library :: get_queue()->has_flag(Q_RANDOM), true); test_equal(deck :: get_queues().size(), (size_t)2); @@ -143,10 +149,6 @@ static void test_next_prev() int main(int argc, char **argv) { - test :: cp_data_dir(); - tagdb :: init(); - library :: init(); - run_test("Deck Init Test", test_init); run_test("Deck Create, Move and Destroy Test", test_create_mv_destroy); run_test("Deck Next and Prev Test", test_next_prev);