summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--clip.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/clip.c b/clip.c
index ded387b..82b15ea 100644
--- a/clip.c
+++ b/clip.c
@@ -208,11 +208,11 @@ rectclipline(Rectangle r, Point *p0, Point *p1)
p0->y += (r.max.x - p0->x)*m;
p0->x = r.max.x;
}else if(code0 & CLIPB){
- if(p0->x != p1->x)
+ if(p0->x != p1->x && m != 0)
p0->x += (r.min.y - p0->y)/m;
p0->y = r.min.y;
}else if(code0 & CLIPT){
- if(p0->x != p1->x)
+ if(p0->x != p1->x && m != 0)
p0->x += (r.max.y - p0->y)/m;
p0->y = r.max.y;
}