From d09d30e173004bedbed3a6f627b833dedd69c29a Mon Sep 17 00:00:00 2001 From: Kp Date: Sat, 19 Mar 2022 22:55:58 +0000 Subject: [PATCH] Make mix_play_file only skip hmp for dot-less filenames Previously, if the filename had no dots, then mix_play_file would refuse to play it at all. This was excessive, as only the check for hmp needs a filename with a dot in it. Change the logic so that a dot-less file still is assumed not to be an hmp, but instead of returning, will fall through and try the other load types. --- common/arch/sdl/digi_mixer_music.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/common/arch/sdl/digi_mixer_music.cpp b/common/arch/sdl/digi_mixer_music.cpp index 68605184f..a63af747c 100644 --- a/common/arch/sdl/digi_mixer_music.cpp +++ b/common/arch/sdl/digi_mixer_music.cpp @@ -151,19 +151,13 @@ static CurrentMusicType load_mus_file(const char *filename, int loop, void (*con int mix_play_file(const char *filename, int loop, void (*const entry_hook_finished_track)()) { std::array full_path; - const char *fptr; unsigned int bufsize = 0; mix_free_music(); // stop and free what we're already playing, if anything - fptr = strrchr(filename, '.'); - - if (fptr == NULL) - return 0; - const auto hook_finished_track = entry_hook_finished_track ? entry_hook_finished_track : mix_free_music; // It's a .hmp! - if (!d_stricmp(fptr, ".hmp")) + if (const auto fptr = strrchr(filename, '.'); fptr && !d_stricmp(fptr, ".hmp")) { hmp2mid(filename, current_music_hndlbuf); current_music_type = load_mus_data(current_music_hndlbuf.data(), current_music_hndlbuf.size(), loop, hook_finished_track);