Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2022-04-02 07:22:17 +0300
committerHans Goudey <h.goudey@me.com>2022-04-02 07:22:51 +0300
commita567bef5ccae851316868ee427f97e214c2afe61 (patch)
tree1c5926b9f5fc24ebef1817fd0add460af310edce
parentad35453cd19b3db779b0b3a90feac2e93c7a73cf (diff)
Fix: Assert with set origin operation and single active object
Array has bounds checking that a raw pointer didn't have before.
-rw-r--r--source/blender/editors/object/object_transform.cc4
1 files changed, 2 insertions, 2 deletions
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;
}