Null pointer checks for music filenames

git-svn-id: https://svn.eduke32.com/eduke32@389 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-12-06 23:14:49 +00:00
parent bee93c60b7
commit c45445f8aa
6 changed files with 25 additions and 10 deletions

View file

@ -7853,15 +7853,18 @@ void nonsharedkeys(void)
{
if (i == 5 && ps[myconnectindex].fta > 0 && ps[myconnectindex].ftq == 26)
{
i = (VOLUMEALL?num_volumes*MAXLEVELS:6);
i = (VOLUMEALL?MAXVOLUMES*MAXLEVELS:6);
music_select++;
while ((music_fn[0][(unsigned char)music_select] == NULL) && music_select < i)
music_select++;
if (music_select == i)
music_select = 0;
if (music_fn[0][(unsigned char)music_select] != NULL)
{
Bsprintf(fta_quotes[26],"PLAYING %s",&music_fn[0][(unsigned char)music_select][0]);
FTA(26,&ps[myconnectindex]);
playmusic(&music_fn[0][(unsigned char)music_select][0]);
}
return;
}
@ -8077,7 +8080,9 @@ FAKE_F3:
if (KB_KeyPressed(sc_F5) && MusicDevice >= 0)
{
KB_ClearKeyDown(sc_F5);
if (music_fn[0][(unsigned char)music_select] != NULL)
Bstrcpy(fta_quotes[26],&music_fn[0][(unsigned char)music_select][0]);
else fta_quotes[26][0] = '\0';
Bstrcat(fta_quotes[26],". USE SHIFT-F5 TO CHANGE.");
FTA(26,&ps[myconnectindex]);
}

View file

@ -4400,7 +4400,7 @@ SKIPJIBS:
break;
}
if (levnume > MAXLEVELS-1 || levnume <0)
if (levnume > MAXLEVELS-1 || levnume < 0)
{
/*
if(g_cmddebug&CMDDEBUG_COMPILE)
@ -6532,6 +6532,7 @@ good:
{
insptr++;
music_select=*insptr++;
if (music_fn[ud.volume_number][(unsigned char)music_select] != NULL)
playmusic(&music_fn[ud.volume_number][(unsigned char)music_select][0]);
break;
}

View file

@ -3974,7 +3974,10 @@ cheat_for_port_credits:
else
{
if (ud.recstat != 2 && ps[myconnectindex].gm&MODE_GAME)
{
if (music_fn[0][(unsigned char)music_select] != NULL)
playmusic(&music_fn[0][(unsigned char)music_select][0]);
}
else playmusic(&env_music_fn[0][0]);
MUSIC_Continue();

View file

@ -1750,6 +1750,7 @@ int enterlevel(char g)
if (ud.recstat != 2)
{
music_select = (ud.volume_number*MAXLEVELS) + ud.level_number;
if (music_fn[0][(unsigned char)music_select] != NULL)
playmusic(&music_fn[0][(unsigned char)music_select][0]);
}

View file

@ -354,6 +354,7 @@ int loadplayer(signed char spot)
cacheit();
music_select = (ud.volume_number*MAXLEVELS) + ud.level_number;
if (music_fn[0][(unsigned char)music_select] != NULL)
playmusic(&music_fn[0][(unsigned char)music_select][0]);
ps[myconnectindex].gm = MODE_GAME;

View file

@ -208,6 +208,8 @@ void playmusic(char *fn)
short fp;
long l;
if (fn == NULL) return;
if (MusicToggle == 0) return;
if (MusicDevice < 0) return;
@ -228,6 +230,8 @@ void playmusic(char *fn)
#else
void PlayMusic(char *_filename);
if (fn == NULL) return;
if(MusicToggle == 0) return;
if(MusicDevice < 0) return;