Merge pull request #332 from samisalreadytaken/fix-oob

Fix OOB access
This commit is contained in:
Blixibon 2025-01-04 08:50:13 -06:00 committed by GitHub
commit de598346da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8045,10 +8045,13 @@ int CAI_BaseNPC::UnholsterWeapon( void )
if (i == -1) if (i == -1)
{ {
// Set i to the first weapon you can find // Set i to the first weapon you can find
for (i = 0; i < WeaponCount(); i++) for (i = 0;;)
{ {
if (GetWeapon(i)) if (GetWeapon(i))
break; break;
if (++i >= WeaponCount())
return -1;
} }
} }
#else #else