Handle division by zero
This commit is contained in:
@@ -121,6 +121,7 @@ LISP_FUNC_2(ucl_builtin_div, state, arg0, arg1) {
|
|||||||
return ucl_error_create("Invalid type of argument 1 to 'div'");
|
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);
|
return ucl_int_create(arg0->integer / arg1->integer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user