diff options
Diffstat (limited to 'src/pj_inv.c')
| -rw-r--r-- | src/pj_inv.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pj_inv.c b/src/pj_inv.c index ee2b44f8..a418ccd4 100644 --- a/src/pj_inv.c +++ b/src/pj_inv.c @@ -10,13 +10,17 @@ pj_inv(XY xy, PJ *P) { /* can't do as much preliminary checking as with forward */ if (xy.x == HUGE_VAL || xy.y == HUGE_VAL) { lp.lam = lp.phi = HUGE_VAL; - pj_errno = -15; + pj_ctx_set_errno( P->ctx, -15); + return lp; } + errno = pj_errno = 0; + P->ctx->last_errno = 0; + xy.x = (xy.x * P->to_meter - P->x0) * P->ra; /* descale and de-offset */ xy.y = (xy.y * P->to_meter - P->y0) * P->ra; lp = (*P->inv)(xy, P); /* inverse project */ - if (pj_errno || (pj_errno = errno)) + if (P->ctx->last_errno ) lp.lam = lp.phi = HUGE_VAL; else { lp.lam += P->lam0; /* reduce from del lp.lam */ |
