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:
authorJulian Eisel <eiseljulian@gmail.com>2015-04-22 18:19:23 +0300
committerJulian Eisel <eiseljulian@gmail.com>2015-04-22 18:20:10 +0300
commit798facbff3a3aca7dc09e4609c2e848cd6bf26c9 (patch)
treed2a7fc3e2f25b5a83fd9a1c40635bf8683d1d591 /source/blender/editors/object
parentd354eeab7460ba76f92f3dcce3eea069010635b3 (diff)
Fix crashes when moving game property with invalid index (from py/redo
panel) Also hides index option in redo panel to be consistent with similar operators
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_edit.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 562f566c562..706ca5fbdfe 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -1784,6 +1784,10 @@ static int game_property_move(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
prop = BLI_findlink(&ob->prop, index);
+ /* invalid index */
+ if (prop == NULL)
+ return OPERATOR_CANCELLED;
+
if (dir == GAME_PROPERTY_MOVE_UP) {
otherprop = prop->prev;
}
@@ -1812,10 +1816,11 @@ void OBJECT_OT_game_property_move(wmOperatorType *ot)
{GAME_PROPERTY_MOVE_DOWN, "DOWN", 0, "Down", ""},
{0, NULL, 0, NULL, NULL}
};
+ PropertyRNA *prop;
/* identifiers */
ot->name = "Move Game Property";
- ot->description = "Move game property";
+ ot->description = "Move game property";
ot->idname = "OBJECT_OT_game_property_move";
/* api callbacks */
@@ -1825,7 +1830,9 @@ void OBJECT_OT_game_property_move(wmOperatorType *ot)
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
- RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to move", 0, INT_MAX);
+ /* properties */
+ prop = RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Property index to move", 0, INT_MAX);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
RNA_def_enum(ot->srna, "direction", direction_property_move, 0, "Direction",
"Direction for moving the property");
}