Skip to content

Commit 30a7868

Browse files
committed
add raise error to catch bugs
1 parent c83652b commit 30a7868

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/problem.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,14 @@ void problem_register_params(problem *prob, expr **param_nodes, int n_param_node
375375

376376
void problem_update_params(problem *prob, const double *theta)
377377
{
378+
/* raise error if there are no parameters */
379+
if (prob->n_param_nodes == 0)
380+
{
381+
fprintf(stderr, "Error: No parameters registered. This is a bug and should "
382+
"be reported.\n");
383+
exit(1);
384+
}
385+
378386
for (int i = 0; i < prob->n_param_nodes; i++)
379387
{
380388
expr *pnode = prob->param_nodes[i];

0 commit comments

Comments
 (0)