Changing the 'and' to an 'or' seems to resolve the issue without breaking the intended behaviour. I assume that the intended behaviour is for units to skip waypoints along unobstructed terrain without skipping over corners they they need to take.

Does not smell like a typo: if the range-test fails but skipping the waypoint is still allowed (e.g. because cwp happens to be within SQUARE_SIZE elmos of pos), CanSetNextWayPoint should not return false.