aboutsummaryrefslogtreecommitdiff
path: root/src/pj_factors.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pj_factors.c')
-rw-r--r--src/pj_factors.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/pj_factors.c b/src/pj_factors.c
index 31c0e539..6ba993b9 100644
--- a/src/pj_factors.c
+++ b/src/pj_factors.c
@@ -17,12 +17,19 @@ int pj_factors(LP lp, const PJ *P, double h, struct FACTORS *fac) {
PJ_COORD coo = {{0, 0, 0, 0}};
coo.lp = lp;
- err = proj_errno_reset (P);
+ /* Failing the 3 initial checks will most likely be due to */
+ /* earlier errors, so we leave errno alone */
+ if (0==fac)
+ return 1;
- if (0==fac) {
- proj_errno_set (P, ENOMEM);
+ if (0==P)
return 1;
- }
+
+ if (HUGE_VAL==lp.lam)
+ return 1;
+
+ /* But from here, we're ready to make our own mistakes */
+ err = proj_errno_reset (P);
/* Indicate that all factors are numerical approximations */
fac->code = 0;