Avoid key error in connected_ids()

Continue through the loop if we could't access the grains instead of
crashing and burning.

Closes #15143