diff options
| author | Kristian Evers <kristianevers@gmail.com> | 2018-01-11 16:34:47 +0100 |
|---|---|---|
| committer | Kristian Evers <kristianevers@gmail.com> | 2018-01-11 16:34:47 +0100 |
| commit | fb69e67f8694fd61943cc9f9c2da75ec35ce9841 (patch) | |
| tree | 6e58a4cf7f637aea87ec3ab05838766323c4329d /src | |
| parent | 07bb446ec474cf62094070a8ea848b37c911a075 (diff) | |
| download | PROJ-fb69e67f8694fd61943cc9f9c2da75ec35ce9841.tar.gz PROJ-fb69e67f8694fd61943cc9f9c2da75ec35ce9841.zip | |
Fail gracefully when invalid inverse operation is specified in cct.
Similar to proj and cs2cs, cct now returns immediately when trying to
do an inverse operation that is not possible, for example using
proj=urm5 which doesn't have an inverse:
$ cct.exe -I +proj=pipeline +step +proj=urm5 +n=0.5
Inverse operation not available
Diffstat (limited to 'src')
| -rw-r--r-- | src/cct.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -217,9 +217,15 @@ int main(int argc, char **argv) { return 1; } - /* We have no API call for inverting an operation, so we brute force it. */ - if (direction==-1) + if (direction==-1) { + /* fail if an inverse operation is not available */ + if (!proj_pj_info(P).has_inverse) { + fprintf (stderr, "Inverse operation not available\n"); + return 1; + } + /* We have no API call for inverting an operation, so we brute force it. */ P->inverted = !(P->inverted); + } direction = 1; /* Allocate input buffer */ |
