Cant figure out why this code with GetComponent() doesnt work

void Vision()
bool above = false, below = false;
GameObject objects = GameObject.FindGameObjectsWithTag(“Soldier”);
foreach( GameObject go in objects )
Soldier sldr = go.GetComponent();
if (sldr == null)
Debug.Log(“Can’t get soldier component!!!”);
if (sldr.IsAlive())
if (sldr.transform.position.y < transform.position.y)
below = true;
else if (sldr.transform.position.y > transform.position.y)
above = true;

GetComponent was returning null always. Everything else was working fine. After some debugging I found that somehow Unity found 31 objects with such tag instead of 30 (unbelievable). Seems one was without attached script or so. Dunno how but now it’s always 30 and works well. Thanks for help.