summaryrefslogtreecommitdiffstats
path: root/filter/filter.c
diff options
context:
space:
mode:
authorPavel Machek <pavel@ucw.cz>2000-06-02 10:01:12 +0200
committerPavel Machek <pavel@ucw.cz>2000-06-02 10:01:12 +0200
commit64ba9f7bcc4bb3b53c0cab303c230855a1443a42 (patch)
treecacd95cff776e3d961eaf9719b83935aefbb6cb7 /filter/filter.c
parent326e33f521f7796cbdde4a36a67bb4c7ffd25c1b (diff)
downloadbird-64ba9f7bcc4bb3b53c0cab303c230855a1443a42.tar
bird-64ba9f7bcc4bb3b53c0cab303c230855a1443a42.zip
Do not try to divide by zero.
Diffstat (limited to 'filter/filter.c')
-rw-r--r--filter/filter.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/filter/filter.c b/filter/filter.c
index 232a2d2..776ad55 100644
--- a/filter/filter.c
+++ b/filter/filter.c
@@ -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;