star-meteo

Time varying meteorological data
git clone git://git.meso-star.fr/star-meteo.git
Log | Files | Refs | README | LICENSE

commit 7e7e4aa31162f7f175973347c9aac39a8907bc59
parent d9b64d66ad39a77ac1d33102d1d367bade45beff
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu, 14 Aug 2025 17:05:21 +0200

stardis: make creation functions robust to bad args

Return an error rather than asserting that they are valid.

Diffstat:
Msrc/stardis_smeteo.c | 3+--
Msrc/stardis_smeteo_library.c | 2++
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/stardis_smeteo.c b/src/stardis_smeteo.c @@ -124,8 +124,7 @@ stardis_create_data struct boundary_condition* bcond = NULL; res_T res = RES_OK; - ASSERT(lib_data && argc && argv); - (void)ctx; /* Avoid "unused variable" warning */ + if(!ctx || !lib_data || !argc || !argv) goto error; if((res = args_init(&args, (int)argc, argv)) != RES_OK) goto error; if(!(bcond = mem_calloc(1, sizeof(*bcond)))) goto error; diff --git a/src/stardis_smeteo_library.c b/src/stardis_smeteo_library.c @@ -134,6 +134,8 @@ stardis_create_library_data res_T res = RES_OK; + if(!ctx || argc < 1 || !argv) goto error; + /* Parse library arguments */ if((res = args_init(&args, (int)argc, argv)) != RES_OK) goto error;