Check for null return value for getBoundingClientRect.