diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/pj_init.c | 8 | ||||
| -rw-r--r-- | src/pj_strerrno.c | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/pj_init.c b/src/pj_init.c index fefcb8fa..bac40740 100644 --- a/src/pj_init.c +++ b/src/pj_init.c @@ -621,6 +621,10 @@ pj_init_ctx(projCtx ctx, int argc, char **argv) { PIN->to_meter = pj_strtod(s, &s); if (*s == '/') /* ratio number */ PIN->to_meter /= pj_strtod(++s, 0); + if (PIN->to_meter <= 0.0) { + pj_ctx_set_errno( ctx, -51); + goto bum_call; + } PIN->fr_meter = 1. / PIN->to_meter; } else PIN->to_meter = PIN->fr_meter = 1.; @@ -636,6 +640,10 @@ pj_init_ctx(projCtx ctx, int argc, char **argv) { PIN->vto_meter = pj_strtod(s, &s); if (*s == '/') /* ratio number */ PIN->vto_meter /= pj_strtod(++s, 0); + if (PIN->vto_meter <= 0.0) { + pj_ctx_set_errno( ctx, -51); + goto bum_call; + } PIN->vfr_meter = 1. / PIN->vto_meter; } else { PIN->vto_meter = PIN->to_meter; diff --git a/src/pj_strerrno.c b/src/pj_strerrno.c index 8a2a9c4b..36b7de8a 100644 --- a/src/pj_strerrno.c +++ b/src/pj_strerrno.c @@ -56,6 +56,7 @@ pj_err_list[] = { "point not within available datum shift grids", /* -48 */ "invalid sweep axis, choose x or y", /* -49 */ "malformed pipeline", /* -50 */ + "unit conversion factor must be > 0", /* -51 */ }; char *pj_strerrno(int err) { |
