commit 79a5087980a354a9500486a4cbbef75016397799
parent 042966b1fc26e52e61b6e2a9c96f0393e852694b
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 5 Feb 2026 15:21:58 +0100
Updates to error messages when loading mixture isotopes
These are mainly formatting updates but some strings to be printed could
be null.
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/sln_mixture.c b/src/sln_mixture.c
@@ -306,26 +306,28 @@ parse_isotope
iiso = molecule->nisotopes; /* Local index of the isotope */
#define LOG(Type, Str, ...) \
- Type(mixture->sln, "%s:%lu "Str, \
+ Type(mixture->sln, "%s:%lu: "Str, \
txtrdr_get_name(txtrdr), (unsigned long)txtrdr_get_line_num(txtrdr), \
__VA_ARGS__)
tk = strtok_r(line, " \t", &tk_ctx);
res = cstr_to_int(tk, &iso_id);
if(res != RES_OK) {
- LOG(ERROR, "invalid isotope index `%s'\n", tk);
+ LOG(ERROR, "invalid isotope index `%s'\n", tk ? tk : "(null)");
goto error;
}
if(iso_id != molecule->param.isotopes[iiso].id) {
- LOG(ERROR, "expecting the %s isotope %d\n",
- shtr_molecule_cstr(molecule->id), iso_id);
+ LOG(ERROR,
+ "expecting isotope %d of %s, whereas the actual isotope is %d\n",
+ molecule->param.isotopes[iiso].id, shtr_molecule_cstr(molecule->id),
+ iso_id);
goto error;
}
tk = strtok_r(NULL, " \t", &tk_ctx);
res = cstr_to_double(tk, &molecule->param.isotopes[iiso].abundance);
if(res != RES_OK || molecule->param.isotopes[iiso].abundance < 0) {
- LOG(ERROR, "invalid isotope abundance `%s'\n", tk);
+ LOG(ERROR, "invalid isotope abundance `%s'\n", tk ? tk : "(null)");
res = RES_BAD_ARG;
goto error;
}