Fix Location.IsValid check for NaN.