diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-02-14 05:01:08 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-02-14 05:01:08 +0400 |
commit | 9bd1e46b4a31ee19834b39ec997f746307486941 (patch) | |
tree | 719d2201ff34b538108baeea1a5f50b47d31ac2b | |
parent | 42f987236363b443a523e4df929b8a05a9cbb27b (diff) |
add missing NULL checks - could cause crashes in rare cases.
-rw-r--r-- | source/blender/makesrna/intern/rna_sculpt_paint.c | 2 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_keymap.c | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 5aa4fa81076..e0687295c70 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -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; diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 3739462ac2c..a296c742e5c 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -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); |