Fix potential bug of judge

In case the coordinate doesn't exist.