From 85502e5516e6a50518dbc90ccfc55f4edf3ba109 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Mon, 14 Mar 2011 20:04:33 +0000 Subject: [PATCH] Don't crash at the end of the last song on a playlist --- src/core/player.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/player.cpp b/src/core/player.cpp index a78aed6a9..af5d822be 100644 --- a/src/core/player.cpp +++ b/src/core/player.cpp @@ -392,8 +392,11 @@ void Player::TrackAboutToEnd() { const bool current_contains_multiple_tracks = current_item_->options() & PlaylistItem::ContainsMultipleTracks; const bool has_next_row = playlists_->active()->next_row() != -1; - const PlaylistItemPtr next_item = playlists_->active()->item_at( - playlists_->active()->next_row()); + PlaylistItemPtr next_item; + + if (has_next_row) { + next_item = playlists_->active()->item_at(playlists_->active()->next_row()); + } if (engine_->is_autocrossfade_enabled()) { // Crossfade is on, so just start playing the next track. The current one