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:
authorCampbell Barton <ideasman42@gmail.com>2011-02-25 07:15:45 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-02-25 07:15:45 +0300
commit8a1cff54ceb9a136fc5a254eeffd20939c3e8fa6 (patch)
tree5b2e9a0908dcaf81e75aa96a9b67beaece137447 /source/blender/windowmanager
parentaa9c91f01a67d12e37809ad29f46bc46c19fd3d9 (diff)
internal operator/wm/macro function: dont crash if operators are not found (warning will be printed).
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index bda5db96133..f5c19f75a5a 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -382,21 +382,24 @@ void WM_operatortype_append_macro_ptr(void (*opfunc)(wmOperatorType*, void*), vo
wmOperatorTypeMacro *WM_operatortype_macro_define(wmOperatorType *ot, const char *idname)
{
wmOperatorTypeMacro *otmacro= MEM_callocN(sizeof(wmOperatorTypeMacro), "wmOperatorTypeMacro");
-
+
BLI_strncpy(otmacro->idname, idname, OP_MAX_TYPENAME);
/* do this on first use, since operatordefinitions might have been not done yet */
WM_operator_properties_alloc(&(otmacro->ptr), &(otmacro->properties), idname);
WM_operator_properties_sanitize(otmacro->ptr, 1);
-
+
BLI_addtail(&ot->macro, otmacro);
{
+ /* operator should always be found but in the event its not. dont segfault */
wmOperatorType *otsub = WM_operatortype_find(idname, 0);
- RNA_def_pointer_runtime(ot->srna, otsub->idname, otsub->srna,
- otsub->name, otsub->description);
+ if(otsub) {
+ RNA_def_pointer_runtime(ot->srna, otsub->idname, otsub->srna,
+ otsub->name, otsub->description);
+ }
}
-
+
return otmacro;
}