Fix T93380: Texture paint clone tool crash without clone image

This was crashing using the clone tool without a clone image assigned.

Caused by {rB9111ea78acf4}.
Since above commit, `BKE_image_acquire_ibuf` was using `ima->runtime`
without checking for NULL first.
Since callers are not required to check for this, just return early
here.

note: there is still a memory leak using the clone tool without a clone
image assigned (but this was also the case before said commit and needs
to be investigated separately).

Maniphest Tasks: T93380

Differential Revision: https://developer.blender.org/D13377
This commit is contained in:
Philipp Oeser 2021-11-26 08:33:45 +01:00
parent dcc500e5a2
commit 236be8e9f1
Notes: blender-bot 2023-02-14 05:36:11 +01:00
Referenced by issue #93380, Texture paint ,clone brush first click crash
1 changed files with 5 additions and 1 deletions

View File

@ -5142,12 +5142,16 @@ static ImBuf *image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
/* return image buffer for given image and user
*
* - will lock render result if image type is render result and lock is not NULL
* - will return NULL if image type if render or composite result and lock is NULL
* - will return NULL if image is NULL or image type is render or composite result and lock is NULL
*
* references the result, BKE_image_release_ibuf should be used to de-reference
*/
ImBuf *BKE_image_acquire_ibuf(Image *ima, ImageUser *iuser, void **r_lock)
{
if (ima == NULL) {
return NULL;
}
ImBuf *ibuf;
BLI_mutex_lock(ima->runtime.cache_mutex);