Ive noticed a bug in my source code i am using but i cant figure out why this happens.

the problem occurs when im in a comp and someone leaves the game creating a bot. it stops the esp from working on all players at times it only works on 1 or 2 players.

I feel it has something to do with this but im not sure any help please?

Code:
void glow(DWORD client_dll,int i) {
DWORD dwGlowPointer = ReadMemory<DWORD>(hacks.process_h,client_dll + off.glowObject); //The Adress of the glow object
int iObjectCount = ReadMemory<DWORD>(hacks.process_h, client_dll + off.glowObject + 0x4); //Object count
if (dwGlowPointer != NULL && iObjectCount > 0) {
for (int t = 0; t < iObjectCount; t++)
{
Information::glow_s glowObject = ReadMemory<Information::glow_s>(hacks.process_h, dwGlowPointer+t*0x38);
if (glowObject.dwBase == NULL)
{
continue;
}
if (glowObject.dwBase == PlayerList[i].dwCurrentEntity) //If it's a player
{
if (PlayerList[i].iTeam == MyPlayer.iTeam && PlayerList[i].dormant == 0)
{
ActivateGlow(glowObject,t,dwGlowPointer, 10.0f, 10.0f, 10.0f); //r,g,b
}
if (PlayerList[i].iTeam != MyPlayer.iTeam && PlayerList[i].dormant == 0) {
ActivateGlow(glowObject, t, dwGlowPointer, 10.0f, 1.0f, 10.0f); //r,g,b 50.0f, 0.0f, 50.0f
}