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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-03-15 11:08:00 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-03-15 11:08:00 +0400
commit85b62997477d1133e377f447b4495adf04c723a6 (patch)
treeac5b29b5392eec377834a6ec06dfa97dc44b2f8f
parent55a05a9b0395fd0957505ac4acfb65ceda658542 (diff)
Fix #34633: Merge First/Last crashes Blender
It was check happening when generating menu with available modes for merge operator, but no checks happened when executing operator. Since operator could be called from python or shortcut, it was possible to bypass all the checks.
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 39a5ac534d3..148c6c413d0 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -2160,12 +2160,22 @@ static int merge_firstlast(BMEditMesh *em, int first, int uvmerge, wmOperator *w
BMVert *mergevert;
BMEditSelection *ese;
+ /* operator could be called directly from shortcut or python,
+ * so do extra check for data here
+ */
+
/* do sanity check in mergemenu in edit.c ?*/
if (first == 0) {
+ if (!em->bm->selected.last || ((BMEditSelection *)em->bm->selected.last)->htype != BM_VERT)
+ return OPERATOR_CANCELLED;
+
ese = em->bm->selected.last;
mergevert = (BMVert *)ese->ele;
}
else {
+ if (!em->bm->selected.first || ((BMEditSelection *)em->bm->selected.first)->htype != BM_VERT)
+ return OPERATOR_CANCELLED;
+
ese = em->bm->selected.first;
mergevert = (BMVert *)ese->ele;
}