fix for 2 crashes from missing NULL checks.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 8 Mar 2012 00:23:28 +0000 (00:23 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 8 Mar 2012 00:23:28 +0000 (00:23 +0000)
source/blender/blenkernel/intern/editderivedmesh.c
source/blender/editors/mesh/bmesh_tools.c
source/blender/editors/object/object_vgroup.c
source/blender/modifiers/intern/MOD_fluidsim_util.c

index 06712d38890f35b9664ac967ba6641f2ee70c0a9..943f499ed1b23f843b8a537b58d4ee15ef899cc6 100644 (file)
@@ -1717,5 +1717,5 @@ DerivedMesh *getEditDerivedBMesh(
 BMEditMesh *BMEdit_FromObject(Object *ob)
 {
        BLI_assert(ob->type == OB_MESH);
-       return ((Mesh *)   ob->data   )->edit_btmesh;
+       return ((Mesh *)ob->data)->edit_btmesh;
 }
index fa36113135eb1470870b562c0f6c6d42ada00483..d1a8b2ae89678774690b577a1a1b707b5d25169e 100644 (file)
@@ -413,7 +413,7 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot)
        
        /* api callbacks */
        ot->exec = extrude_repeat_mesh;
-       ot->poll = ED_operator_editmesh;
+       ot->poll = ED_operator_editmesh_view3d;
        
        /* flags */
        ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
index b0a3518b03ad3b9a69163bd4f17e7b57dc72cedb..870221d6ec32f0bb8cd55c40562073025a484eb2 100644 (file)
@@ -1257,10 +1257,9 @@ static void vgroup_blend(Object *ob)
        int i, dvert_tot=0;
        const int def_nr= ob->actdef-1;
 
-       BMEditMesh *em = BMEdit_FromObject(ob);
-       // ED_vgroup_give_array(ob->data, &dvert_array, &dvert_tot);
+       BMEditMesh *em;
 
-       if (em == NULL) {
+       if (ob->type == OB_MESH && ((em = BMEdit_FromObject(ob)) != NULL)) {
                return;
        }
 
@@ -1302,10 +1301,17 @@ static void vgroup_blend(Object *ob)
                                vg_users[i1]++;
 
                                /* TODO, we may want object mode blending */
-                               if(em)  dvert= CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
-                               else    dvert= dvert_array+i2;
+#if 0
+                               if (em) {
+                                       dvert = CustomData_bmesh_get(&em->bm->vdata, eve->head.data, CD_MDEFORMVERT);
+                               }
+                               else
+#endif
+                               {
+                                       dvert= dvert_array+i2;
+                               }
 
-                               dw= defvert_find_index(dvert, def_nr);
+                               dw = defvert_find_index(dvert, def_nr);
 
                                if(dw) {
                                        vg_weights[i1] += dw->weight;
@@ -2037,7 +2043,7 @@ static int vertex_group_poll(bContext *C)
        return (ob && !ob->id.lib && OB_TYPE_SUPPORT_VGROUP(ob->type) && data && !data->lib);
 }
 
-static int UNUSED_FUNCTION(vertex_group_poll_edit)(bContext *C)
+static int vertex_group_poll_edit(bContext *C)
 {
        Object *ob= ED_object_context(C);
        ID *data= (ob)? ob->data: NULL;
@@ -2502,7 +2508,7 @@ void OBJECT_OT_vertex_group_blend(wmOperatorType *ot)
        ot->description= "";
 
        /* api callbacks */
-       ot->poll= vertex_group_poll;
+       ot->poll= vertex_group_poll_edit; /* TODO - add object mode support */
        ot->exec= vertex_group_blend_exec;
 
        /* flags */
index dc0c4d5ad868b9fc91057426b6c6108faffc5342..e9563b55d4756ba1307216213e45401426bb64d5 100644 (file)
@@ -152,9 +152,8 @@ void fluidsim_init(FluidsimModifierData *fluidmd)
 
 void fluidsim_free(FluidsimModifierData *fluidmd)
 {
-       if(fluidmd) {
-               if(fluidmd->fss->meshVelocities)
-               {
+       if (fluidmd && fluidmd->fss) {
+               if (fluidmd->fss->meshVelocities) {
                        MEM_freeN(fluidmd->fss->meshVelocities);
                        fluidmd->fss->meshVelocities = NULL;
                }