From e49ee5a8084c619905947486c071ddd44c9e42d1 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 19 Oct 2020 12:48:38 +0200 Subject: Fix (unreported) crash when unlinking a brush from a tool. Cursor drawing code was not checking for potential NULL pointers. --- source/blender/editors/sculpt_paint/paint_cursor.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/blender/editors/sculpt_paint/paint_cursor.c') diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 2e24c2533c5..f0285c8faf3 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1265,7 +1265,13 @@ static bool paint_cursor_context_init(bContext *C, pcontext->scene = CTX_data_scene(C); pcontext->ups = &pcontext->scene->toolsettings->unified_paint_settings; pcontext->paint = BKE_paint_get_active_from_context(C); + if (pcontext->paint == NULL) { + return false; + } pcontext->brush = BKE_paint_brush(pcontext->paint); + if (pcontext->brush == NULL) { + return false; + } pcontext->mode = BKE_paintmode_get_active_from_context(C); ED_view3d_viewcontext_init(C, &pcontext->vc, pcontext->depsgraph); -- cgit v1.2.3