From 1cf8a4e5ea5dc1e791c1b242d7d2d032dd194c78 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 14 Oct 2020 10:00:24 -0500 Subject: [PATCH] Fix Asan warning in property editor texture tab When there is no active texture, a NULL pointer was dereferenced. It didn't crash because the dereference was for the first item at the pointer, the ID. To fix this, return with no data when `texture is NULL. --- source/blender/editors/space_buttons/buttons_context.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 0b018d05058..dcf2e6e74fa 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -880,6 +880,10 @@ int /*eContextResult*/ buttons_context(const bContext *C, ButsContextTexture *ct = sbuts->texuser; if (ct) { + if (ct->texture == NULL) { + return CTX_RESULT_NO_DATA; + } + CTX_data_pointer_set(result, &ct->texture->id, &RNA_Texture, ct->texture); }