Handle division by zero

This commit is contained in:
2022-11-14 22:34:37 -05:00
parent f13d23c528
commit 2af3c15785

View File

@@ -121,6 +121,7 @@ LISP_FUNC_2(ucl_builtin_div, state, arg0, arg1) {
return ucl_error_create("Invalid type of argument 1 to 'div'");
}
UCL_COND_OR_RET_ERROR(arg1->integer != 0, "Division by zero");
return ucl_int_create(arg0->integer / arg1->integer);
}