diff --git a/sp/src/game/server/ai_basenpc.cpp b/sp/src/game/server/ai_basenpc.cpp index 2d4c064c..1622ec8d 100644 --- a/sp/src/game/server/ai_basenpc.cpp +++ b/sp/src/game/server/ai_basenpc.cpp @@ -8045,10 +8045,13 @@ int CAI_BaseNPC::UnholsterWeapon( void ) if (i == -1) { // Set i to the first weapon you can find - for (i = 0; i < WeaponCount(); i++) + for (i = 0;;) { if (GetWeapon(i)) break; + + if (++i >= WeaponCount()) + return -1; } } #else