Check for null before looping.