sounds.c: don't crash S_PlayMusic() if passed null pointer for 'fn'.

This may happen if no title/end music is defined from CON.
Thanks to Zaxtor for the bug report.

git-svn-id: https://svn.eduke32.com/eduke32@4871 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2014-12-28 22:12:40 +00:00
parent d73c7f1afe
commit 61f7c9e30f
1 changed files with 3 additions and 0 deletions

View File

@ -221,6 +221,9 @@ int32_t S_PlayMusic(const char *fn, const int32_t sel)
if (MapInfo[sel].ext_musicfn != NULL)
alt = fn = MapInfo[sel].ext_musicfn;
if (fn == NULL)
return 0;
testfn = (char *)Xmalloc(strlen(fn) + 6);
strcpy(testfn, fn);
extension = strrchr(testfn, '.');