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.
This commit is contained in:
Hans Goudey 2020-10-14 10:00:24 -05:00
parent fecb276ef7
commit 1cf8a4e5ea
Notes: blender-bot 2023-02-14 01:52:41 +01:00
Referenced by issue #81697, Property search crash with python handlers
1 changed files with 4 additions and 0 deletions

View File

@ -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);
}