[Bf-blender-cvs] [a567bef5cca] master: Fix: Assert with set origin operation and single active object
Hans Goudey
noreply at git.blender.org
Sat Apr 2 06:22:53 CEST 2022
Commit: a567bef5ccae851316868ee427f97e214c2afe61
Author: Hans Goudey
Date: Fri Apr 1 23:22:17 2022 -0500
Branches: master
https://developer.blender.org/rBa567bef5ccae851316868ee427f97e214c2afe61
Fix: Assert with set origin operation and single active object
Array has bounds checking that a raw pointer didn't have before.
===================================================================
M source/blender/editors/object/object_transform.cc
===================================================================
diff --git a/source/blender/editors/object/object_transform.cc b/source/blender/editors/object/object_transform.cc
index 36d70eeef64..235ffb61738 100644
--- a/source/blender/editors/object/object_transform.cc
+++ b/source/blender/editors/object/object_transform.cc
@@ -1263,12 +1263,12 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
}
/* reset flags */
- for (int object_index = 0; object_index < objects.size(); object_index++) {
+ for (const int object_index : objects.index_range()) {
Object *ob = objects[object_index];
ob->flag &= ~OB_DONE;
/* move active first */
- if (ob == obact) {
+ if (ob == obact && objects.size() > 1) {
memmove(&objects[1], objects.data(), object_index * sizeof(Object *));
objects[0] = ob;
}
More information about the Bf-blender-cvs
mailing list