Correctly detect and handle invalid input world coordinates.

As reported by Maik Reichert on the Astropy mailing list thread  "Bug in wcs_world2pix?"
"pass" -> "passed"