diff options
author | Zack Middleton <zturtleman@gmail.com> | 2012-11-19 00:40:03 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-12 21:24:49 +0000 |
commit | 67a61dbd718c7ba9ccc9b3137b16f9022ddb8b34 (patch) | |
tree | d0ff1476371aaec0f47ec540aaddffe0289b38b8 /src/client/snd_dma.c | |
parent | 7a25e48a341c7fafaf71b7d933a94d352b7619a6 (diff) |
- Check for invalid filename in OpenAL's RegisterSound function. - Changed Base sound system to warn not error when sound filename is empty or too long.
Diffstat (limited to 'src/client/snd_dma.c')
-rw-r--r-- | src/client/snd_dma.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/client/snd_dma.c b/src/client/snd_dma.c index 5db92f8a..b6f62800 100644 --- a/src/client/snd_dma.c +++ b/src/client/snd_dma.c @@ -259,14 +259,17 @@ static sfx_t *S_FindName( const char *name ) { sfx_t *sfx; if (!name) { - Com_Error (ERR_FATAL, "S_FindName: NULL"); + Com_Error(ERR_FATAL, "Sound name is NULL"); } + if (!name[0]) { - Com_Error (ERR_FATAL, "S_FindName: empty name"); + Com_Printf( S_COLOR_YELLOW "WARNING: Sound name is empty\n" ); + return NULL; } if (strlen(name) >= MAX_QPATH) { - Com_Error (ERR_FATAL, "Sound name too long: %s", name); + Com_Printf( S_COLOR_YELLOW "WARNING: Sound name is too long: %s\n", name ); + return NULL; } hash = S_HashSFXName(name); @@ -352,12 +355,11 @@ sfxHandle_t S_Base_RegisterSound( const char *name, qboolean compressed ) { return 0; } - if ( strlen( name ) >= MAX_QPATH ) { - Com_Printf( "Sound name exceeds MAX_QPATH\n" ); + sfx = S_FindName( name ); + if ( !sfx ) { return 0; } - sfx = S_FindName( name ); if ( sfx->soundData ) { if ( sfx->defaultSound ) { Com_Printf( S_COLOR_YELLOW "WARNING: could not find %s - using default\n", sfx->soundName ); |