From 06e9e0d0df237e3d505d908ccf264091b440e066 Mon Sep 17 00:00:00 2001 From: Tim Segers Date: Fri, 14 Oct 2022 17:46:07 +0200 Subject: Add requirement that GF Low not be greater than GF High --- src/deco.c | 2 ++ src/opendeco.c | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/deco.c b/src/deco.c index 80853b8..29f07ea 100644 --- a/src/deco.c +++ b/src/deco.c @@ -293,6 +293,8 @@ void init_tissues(decostate_t *ds) void init_decostate(decostate_t *ds, const unsigned char gflo, const unsigned char gfhi, const double ceil_multiple) { + assert(gflo <= gfhi); + init_tissues(ds); ds->gflo = gflo; diff --git a/src/opendeco.c b/src/opendeco.c index ae95f58..5051633 100644 --- a/src/opendeco.c +++ b/src/opendeco.c @@ -98,6 +98,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state) argp_failure(state, 1, 0, "Surface air pressure must be positive. See --help for more information"); exit(ARGP_ERR_UNKNOWN); } + if (arguments->gflow > arguments->gfhigh) { + argp_failure(state, 1, 0, "GF Low must not be greater than GF High"); + exit(ARGP_ERR_UNKNOWN); + } default: return ARGP_ERR_UNKNOWN; } -- cgit v1.2.3-70-g09d2