add missing NULL checks - could cause crashes in rare cases.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 14 Feb 2013 01:01:08 +0000 (01:01 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 14 Feb 2013 01:01:08 +0000 (01:01 +0000)
source/blender/makesrna/intern/rna_sculpt_paint.c
source/blender/windowmanager/intern/wm_keymap.c

index 5aa4fa810766f4c1b2c4437dd3e45002a8564857..e0687295c706e3fa2ff2c97e457ff0fef73a8d14 100644 (file)
@@ -236,7 +236,7 @@ static void rna_Sculpt_ShowDiffuseColor_update(Main *UNUSED(bmain), Scene *scene
 {
        Object *ob = (scene->basact) ? scene->basact->object : NULL;
 
-       if (ob) {
+       if (ob && ob->sculpt) {
                Sculpt *sd = scene->toolsettings->sculpt;
                ob->sculpt->show_diffuse_color = sd->flags & SCULPT_SHOW_DIFFUSE;
 
index 3739462ac2cc20eef2b26ff86b29d1135b5c6a55..a296c742e5cac0f7576de501112225ab20464c8b 100644 (file)
@@ -126,10 +126,13 @@ static int wm_keymap_item_equals(wmKeyMapItem *a, wmKeyMapItem *b)
 /* properties can be NULL, otherwise the arg passed is used and ownership is given to the kmi */
 void WM_keymap_properties_reset(wmKeyMapItem *kmi, struct IDProperty *properties)
 {
-       WM_operator_properties_free(kmi->ptr);
-       MEM_freeN(kmi->ptr);
+       if (LIKELY(kmi->ptr)) {
+               WM_operator_properties_free(kmi->ptr);
+               MEM_freeN(kmi->ptr);
+
+               kmi->ptr = NULL;
+       }
 
-       kmi->ptr = NULL;
        kmi->properties = properties;
 
        wm_keymap_item_properties_set(kmi);