From e26bb897d661535554b72cb3ca4f0f407aa4d5aa Mon Sep 17 00:00:00 2001 From: Sally Cochenour Date: Thu, 23 Apr 2020 14:18:43 -0400 Subject: [PATCH] Prevent divide by zero in slopes code Not exactly sure why this happens, or if this is the correct way to fix it --- src/p_slopes.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/p_slopes.c b/src/p_slopes.c index e623b6f19..03c1205f6 100644 --- a/src/p_slopes.c +++ b/src/p_slopes.c @@ -54,6 +54,13 @@ static void P_ReconfigureVertexSlope(pslope_t *slope) max(max(abs(vec1.x), abs(vec1.y)), abs(vec1.z)), max(max(abs(vec2.x), abs(vec2.y)), abs(vec2.z)) ) >> (FRACBITS+5); + + if (slope->extent == 0) + { + // Prevent divide by zero + slope->extent = 1; + } + vec1.x /= slope->extent; vec1.y /= slope->extent; vec1.z /= slope->extent;