Player: Fix crossfade crash when decoding fails

When the decoding of a track fails, `current_item_` is set to an invalid address, if the Crossfade option is enabled, the `Player::TrackAboutToEnd` method does not check whether `current_item_` is a valid pointer or not, causing a segmentation fault.

Player: Removed extra space
This commit is contained in:
BetterCallMolly 2023-12-03 14:51:59 +01:00 committed by Jonas Kvinge
parent b4f9808d11
commit 84c6e09c42
1 changed files with 3 additions and 0 deletions

View File

@ -867,6 +867,9 @@ void Player::TrackAboutToEnd() {
if (engine_->is_autocrossfade_enabled()) {
// Crossfade is on, so just start playing the next track. The current one will fade out, and the new one will fade in
// If the decoding failed, current_item_ will be null
if (!current_item_) return;
// But, if there's no next track, and we don't want to fade out, then do nothing and just let the track finish to completion.
if (!engine_->is_fadeout_enabled() && !has_next_row) return;