Fix several bugs from iodoom3 bugtracker

rhyskidd@gmail.com found them (with PVS studio IIRC), reported them and posted
patches.
Some of the patches were incorrect so I rewrote them.
This commit is contained in:
Daniel Gibson 2012-05-13 14:40:11 +02:00
parent d51c05c768
commit ca4b20eb08

View file

@ -1257,8 +1257,8 @@ bool idGameLocal::InitFromSaveGame( const char *mapName, idRenderWorld *renderWo
if ( !InhibitEntitySpawn( mapEnt->epairs ) ) { if ( !InhibitEntitySpawn( mapEnt->epairs ) ) {
CacheDictionaryMedia( &mapEnt->epairs ); CacheDictionaryMedia( &mapEnt->epairs );
const char *classname = mapEnt->epairs.GetString( "classname" ); const char *classname;
if ( classname != '\0' ) { if ( mapEnt->epairs.GetString( "classname", "", &classname ) ) {
FindEntityDef( classname, false ); FindEntityDef( classname, false );
} }
} }
@ -1626,8 +1626,9 @@ void idGameLocal::GetShakeSounds( const idDict *dict ) {
const char *soundShaderName; const char *soundShaderName;
idStr soundName; idStr soundName;
soundShaderName = dict->GetString( "s_shader" ); if ( dict->GetString( "s_shader", "", &soundShaderName )
if ( soundShaderName != '\0' && dict->GetFloat( "s_shakes" ) != 0.0f ) { && dict->GetFloat( "s_shakes" ) != 0.0f )
{
soundShader = declManager->FindSound( soundShaderName ); soundShader = declManager->FindSound( soundShaderName );
for ( int i = 0; i < soundShader->GetNumSounds(); i++ ) { for ( int i = 0; i < soundShader->GetNumSounds(); i++ ) {