summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/snd_dma.c14
-rw-r--r--src/client/snd_openal.c14
2 files changed, 22 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 );
diff --git a/src/client/snd_openal.c b/src/client/snd_openal.c
index dc067be0..dc1cf90b 100644
--- a/src/client/snd_openal.c
+++ b/src/client/snd_openal.c
@@ -197,6 +197,20 @@ static sfxHandle_t S_AL_BufferFind(const char *filename)
sfxHandle_t sfx = -1;
int i;
+ if ( !filename ) {
+ Com_Error( ERR_FATAL, "Sound name is NULL" );
+ }
+
+ if ( !filename[0] ) {
+ Com_Printf( S_COLOR_YELLOW "WARNING: Sound name is empty\n" );
+ return 0;
+ }
+
+ if ( strlen( filename ) >= MAX_QPATH ) {
+ Com_Printf( S_COLOR_YELLOW "WARNING: Sound name is too long: %s\n", filename );
+ return 0;
+ }
+
for(i = 0; i < numSfx; i++)
{
if(!Q_stricmp(knownSfx[i].filename, filename))