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:
parent
b4f9808d11
commit
84c6e09c42
|
@ -867,6 +867,9 @@ void Player::TrackAboutToEnd() {
|
||||||
if (engine_->is_autocrossfade_enabled()) {
|
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
|
// 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.
|
// 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;
|
if (!engine_->is_fadeout_enabled() && !has_next_row) return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue