fixed potential bug.

This commit is contained in:
Zohar Malamant 2013-08-15 01:02:38 +02:00 committed by Daniel Gibson
parent b3dc1ee9c6
commit 5a9cdc2ed8

View file

@ -2505,7 +2505,7 @@ idWeapon::GetAmmoNameForNum
================ ================
*/ */
const char *idWeapon::GetAmmoNameForNum( ammo_t ammonum ) { const char *idWeapon::GetAmmoNameForNum( ammo_t ammonum ) {
int i; int i, j;
int num; int num;
const idDict *ammoDict; const idDict *ammoDict;
const idKeyValue *kv; const idKeyValue *kv;
@ -2539,8 +2539,8 @@ const char *idWeapon::GetAmmoNameForNum( ammo_t ammonum ) {
ammoDict = gameLocal.FindEntityDefDict( va("ammo_types_%s", gamedir.c_str()), false ); ammoDict = gameLocal.FindEntityDefDict( va("ammo_types_%s", gamedir.c_str()), false );
if ( ammoDict ) { if ( ammoDict ) {
num = ammoDict->GetNumKeyVals(); num = ammoDict->GetNumKeyVals();
for( i = 0; i < num; i++ ) { for( j = 0; j < num; j++ ) {
kv = ammoDict->GetKeyVal( i ); kv = ammoDict->GetKeyVal( j );
if ( kv->GetValue() == text ) { if ( kv->GetValue() == text ) {
return kv->GetKey(); return kv->GetKey();
} }