This fixes some NULL checks.
authorPeter Schlaile <peter@schlaile.de>
Wed, 8 Jul 2009 11:18:47 +0000 (11:18 +0000)
committerPeter Schlaile <peter@schlaile.de>
Wed, 8 Jul 2009 11:18:47 +0000 (11:18 +0000)
* base was referenced before NULL check
* ob wasn't checked for NULL

Still broken: Add Mesh doesn't seem to work in Object Mode.
But now it doesn't crash anymore...

source/blender/editors/object/object_edit.c

index af6cb887e71c6a424217e14123d64a9443b58b16..90f6250cf8c8e0dab93d7df92dfd3b54d4c02008 100644 (file)
@@ -3261,7 +3261,7 @@ void ED_object_enter_editmode(bContext *C, int flag)
 {
        Scene *scene= CTX_data_scene(C);
        Base *base= CTX_data_active_base(C);
-       Object *ob= base->object;
+       Object *ob;
        ScrArea *sa= CTX_wm_area(C);
        View3D *v3d= NULL;
        int ok= 0;
@@ -3273,7 +3273,10 @@ void ED_object_enter_editmode(bContext *C, int flag)
                v3d= sa->spacedata.first;
        
        if((v3d==NULL || (base->lay & v3d->lay))==0) return;
-       
+
+       ob = base->object;
+
+       if(ob==NULL) return;
        if(ob->data==NULL) return;
        
        if (object_data_is_libdata(ob)) {