check that the nearest wall exists