diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-07-04 09:23:36 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-07-04 09:23:36 +0400 |
commit | 0e0eba9f79b122eeef613fbd3733b339a95094a4 (patch) | |
tree | 494f44c1d81d1c9545b6440165c6eb94d2fa1bd4 /source/blender/makesrna/intern/rna_object.c | |
parent | d29d3a89e48fa709a3d683a88874ff8a4c68945a (diff) |
fix for crash when setting layers or saving when there is no active scene - only really happens when running python scripts on startup.
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_object.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 6b925b42e06..dd66e49fdec 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -270,11 +270,16 @@ static void rna_Base_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po static void rna_Object_layer_update__internal(Main *bmain, Scene *scene, Base *base, Object *ob) { /* try to avoid scene sort */ - if((ob->lay & scene->lay) && (base->lay & scene->lay)) { + if(scene == NULL) { + /* pass - unlikely but when running scripts on startup it happens */ + } + else if((ob->lay & scene->lay) && (base->lay & scene->lay)) { /* pass */ - } else if((ob->lay & scene->lay)==0 && (base->lay & scene->lay)==0) { + } + else if((ob->lay & scene->lay)==0 && (base->lay & scene->lay)==0) { /* pass */ - } else { + } + else { DAG_scene_sort(bmain, scene); } } @@ -284,7 +289,7 @@ static void rna_Object_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr) Object *ob= (Object*)ptr->id.data; Base *base; - base= object_in_scene(ob, scene); + base= scene ? object_in_scene(ob, scene) : NULL; if(!base) return; |