Avoid divide by zero in cpPolyShadeSegmentQuery().
@@ -117,7 +117,8 @@ cpPolyShapeSegmentQuery(cpPolyShape *poly, cpVect a, cpVect b, cpFloat r2, cpSeg
if(d < 0.0f) continue;
cpFloat bn = cpvdot(b, n);
- cpFloat t = d/(an - bn);
+ // Avoid divide by zero. (d is always positive)
+ cpFloat t = d/cpfmax(an - bn, CPFLOAT_MIN);
if(t < 0.0f || 1.0f < t) continue;
cpVect point = cpvlerp(a, b, t);
