diff options
author | Andrey Nazarov <skuller@skuller.net> | 2011-04-26 16:53:00 +0400 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2011-04-26 19:10:43 +0400 |
commit | 776fa0343672058a66f2ed994e67cfa610189a57 (patch) | |
tree | 9d6a6514d4c40b94c12d4ca928c354c4da9f7f71 /src/snd_main.c | |
parent | 107eb88def58d969e3d4ad3948f3244573da9b0e (diff) |
Silently ignore empty configstrings.
With demo seeking in place image/model/sound registration functions may
be often called with empty names, silently ignore them.
Diffstat (limited to 'src/snd_main.c')
-rw-r--r-- | src/snd_main.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/snd_main.c b/src/snd_main.c index 2aa1c2e..34767a2 100644 --- a/src/snd_main.c +++ b/src/snd_main.c @@ -384,8 +384,9 @@ qhandle_t S_RegisterSound( const char *name ) { if( !s_started ) return 0; - if( !name ) - Com_Error( ERR_DROP, "%s: NULL", __func__ ); + // empty names are legal, silently ignore them + if( !*name ) + return 0; if( *name == '*' ) { len = Q_strlcpy( buffer, name, MAX_QPATH ); @@ -397,11 +398,13 @@ qhandle_t S_RegisterSound( const char *name ) { len = FS_NormalizePath( buffer, buffer ); } + // this MAY happen after prepending "sound/" if( len >= MAX_QPATH ) { Com_DPrintf( "%s: oversize name\n", __func__ ); return 0; } + // normalized to empty name? if( len == 0 ) { Com_DPrintf( "%s: empty name\n", __func__ ); return 0; |