From 8fa156efb67eec1a9c4f442b0f571174675cedd9 Mon Sep 17 00:00:00 2001 From: Julien Schueller Date: Mon, 4 Jul 2022 13:23:06 +0200 Subject: [PATCH] options: nlopt_set_xtol_abs check xtol_abs Closes #461 --- src/api/options.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/options.c b/src/api/options.c index 853a5d67..f2b4ac87 100644 --- a/src/api/options.c +++ b/src/api/options.c @@ -689,7 +689,7 @@ GETSET(stopval, double, stopval) GETSET(ftol_rel, double, ftol_rel) GETSET(ftol_abs, double, ftol_abs) GETSET(xtol_rel, double, xtol_rel) nlopt_result NLOPT_STDCALL nlopt_set_xtol_abs(nlopt_opt opt, const double *xtol_abs) { - if (opt) { + if (opt && xtol_abs) { nlopt_unset_errmsg(opt); if (!opt->xtol_abs && opt->n > 0) { opt->xtol_abs = (double *) calloc(opt->n, sizeof(double));