From 79fa26dcf4cccc16ab95f46ac3f7f6e87767680c Mon Sep 17 00:00:00 2001 From: Kristian Evers Date: Sun, 11 Mar 2018 22:28:47 +0100 Subject: Make sure that transient errors are returned correctly The prepare/finalize steps in pj_fwd*/pj_inv* now checks the error level of the PJ object before returning the coordinate. If an error is detected proj_coord_error() is returned. --- src/pj_inv.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/pj_inv.c') diff --git a/src/pj_inv.c b/src/pj_inv.c index 1e84ff30..f9f11f56 100644 --- a/src/pj_inv.c +++ b/src/pj_inv.c @@ -198,6 +198,12 @@ LP pj_inv(XY xy, PJ *P) { if (!P->skip_inv_finalize) coo = inv_finalize (P, coo); + + if (proj_errno(P)) { + proj_errno_reset(P); + return proj_coord_error().lp; + } + return coo.lp; } @@ -228,6 +234,12 @@ LPZ pj_inv3d (XYZ xyz, PJ *P) { if (!P->skip_inv_finalize) coo = inv_finalize (P, coo); + + if (proj_errno(P)) { + proj_errno_reset(P); + return proj_coord_error().lpz; + } + return coo.lpz; } @@ -255,5 +267,11 @@ PJ_COORD pj_inv4d (PJ_COORD coo, PJ *P) { if (!P->skip_inv_finalize) coo = inv_finalize (P, coo); + + if (proj_errno(P)) { + proj_errno_reset(P); + return proj_coord_error(); + } + return coo; } -- cgit v1.2.3