Checks if friends is nil before trying to iterate