Fix further possible nullptr dereferences (Fixes #2161)

This commit is contained in:
Alexander van Gessel 2017-11-07 00:49:15 +01:00
parent 9019074182
commit 8ab8ff702c

View File

@ -244,7 +244,9 @@ void remove_track(unsigned int i)
if(i == current_track_index) {
// Let the track finish playing
current_track->set_play_once(true);
if(current_track){
current_track->set_play_once(true);
}
// Set current index to the new size of the list
current_track_index = current_track_list.size() - 1;
} else if(i < current_track_index) {
@ -599,7 +601,7 @@ static void play_new_music()
music_start_time = 0; // reset status: no start time
want_new_music = true;
if(!preferences::music_on() || !mix_ok || !current_track->valid()) {
if(!preferences::music_on() || !mix_ok || !current_track || !current_track->valid()) {
return;
}
@ -779,7 +781,7 @@ void commit_music_changes()
played_before.clear();
// Play-once is OK if still playing.
if(current_track->play_once()) {
if(current_track && current_track->play_once()) {
return;
}