[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45140] trunk/blender/source/blender/bmesh /operators/bmo_connect.c: Fix bug #30673, "Crash: Bridge a pair of edges."

Nicholas Bishop nicholasbishop at gmail.com
Sun Mar 25 20:19:43 CEST 2012


Revision: 45140
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45140
Author:   nicholasbishop
Date:     2012-03-25 18:19:40 +0000 (Sun, 25 Mar 2012)
Log Message:
-----------
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?

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/operators/bmo_connect.c

Modified: trunk/blender/source/blender/bmesh/operators/bmo_connect.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_connect.c	2012-03-25 17:52:50 UTC (rev 45139)
+++ trunk/blender/source/blender/bmesh/operators/bmo_connect.c	2012-03-25 18:19:40 UTC (rev 45140)
@@ -141,7 +141,15 @@
 /* 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




More information about the Bf-blender-cvs mailing list