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:
-rw-r--r--source/blender/editors/object/object_edit.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index a1d2a6d734a..1ac84eb48ce 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -119,11 +119,15 @@ static bContext *C;
static void error_libdata() {}
-/* find the correct active object per context */
+/* find the correct active object per context
+ * note: context can be NULL when called from a enum with PROP_ENUM_NO_CONTEXT */
Object *ED_object_active_context(bContext *C)
{
- Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
- if (!ob) ob= CTX_data_active_object(C);
+ Object *ob= NULL;
+ if(C) {
+ ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
+ if (!ob) ob= CTX_data_active_object(C);
+ }
return ob;
}