diff options
author | Hans Goudey <h.goudey@me.com> | 2022-04-02 07:22:17 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-04-02 07:22:51 +0300 |
commit | a567bef5ccae851316868ee427f97e214c2afe61 (patch) | |
tree | 1c5926b9f5fc24ebef1817fd0add460af310edce /source/blender/editors/object/object_transform.cc | |
parent | ad35453cd19b3db779b0b3a90feac2e93c7a73cf (diff) |
Fix: Assert with set origin operation and single active object
Array has bounds checking that a raw pointer didn't have before.
Diffstat (limited to 'source/blender/editors/object/object_transform.cc')
-rw-r--r-- | source/blender/editors/object/object_transform.cc | 4 |
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; } |