If either client is not in a group, that code will cause a crash because GetGroup() will return a NULL pointer.
This should work:
Code:
Group *g1 = c1->GetGroup();
Group *g2 = c2->GetGroup();
if(!g1 || !g2 || (g1 != g2)
{
// One or both clients not in a group, or not in the same group
}