Fix bug #30673, "Crash: Bridge a pair of edges."
Fix edge case for clamp_index() with any negative 'x' that is a multiple of 'len', was returning 'len' which is invalid index. Maybe the expression can be simplified back to a one-liner?
This commit is contained in:
@@ -141,7 +141,15 @@ static BMVert *get_outer_vert(BMesh *bm, BMEdge *e)
|
||||
/* Clamp x to the interval {0..len-1}, with wrap-around */
|
||||
static int clamp_index(const int x, const int len)
|
||||
{
|
||||
return (x < 0) ? (len - (-x % len)) : (x % len);
|
||||
if (x >= 0)
|
||||
return x % len;
|
||||
else {
|
||||
int r = len - (-x % len);
|
||||
if(r == len)
|
||||
return len - 1;
|
||||
else
|
||||
return r;
|
||||
}
|
||||
}
|
||||
|
||||
/* There probably is a better way to swap BLI_arrays, or if there
|
||||
|
||||
Reference in New Issue
Block a user