mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-12-22 09:41:54 +00:00
Do not try to divide by zero.
This commit is contained in:
parent
326e33f521
commit
64ba9f7bcc
@ -283,7 +283,8 @@ interpret(struct f_inst *what)
|
||||
TWOARGS_C;
|
||||
switch (res.type = v1.type) {
|
||||
case T_VOID: runtime( "Can not operate with values of type void" );
|
||||
case T_INT: res.val.i = v1.val.i / v2.val.i; break;
|
||||
case T_INT: if (v2.val.i == 0) runtime( "Mother told me not to divide by 0" );
|
||||
res.val.i = v1.val.i / v2.val.i; break;
|
||||
case T_IP: if (v2.type != T_INT)
|
||||
runtime( "Operator / is <ip>/<int>" );
|
||||
break;
|
||||
|
@ -1,5 +1,6 @@
|
||||
/*
|
||||
* This is an example configuration file.
|
||||
* FIXME: add all examples from docs here.
|
||||
*/
|
||||
|
||||
# Yet another comment
|
||||
|
Loading…
Reference in New Issue
Block a user