Manual merge of soc-2009-kazanbas branch:
[blender.git] / source / blender / blenkernel / intern / mesh.c
index c92eda6d169f39a60091b5d4c986044896b4d0a2..431543f8dbd7b68db0e0012c1474b72aeea55582 100644 (file)
@@ -542,7 +542,8 @@ void set_mesh(Object *ob, Mesh *me)
        
        if(ob->type==OB_MESH) {
                old= ob->data;
-               old->id.us--;
+               if (old)
+                       old->id.us--;
                ob->data= me;
                id_us_plus((ID *)me);
        }