[Bf-blender-cvs] [4f128269b2d] master: Fix possible crash with custom (add-on defined) icons

Eric Cosky noreply at git.blender.org
Wed Dec 16 12:14:12 CET 2020


Commit: 4f128269b2dcf453647e7293f68f35173d45486a
Author: Eric Cosky
Date:   Wed Dec 16 12:12:06 2020 +0100
Branches: master
https://developer.blender.org/rB4f128269b2dcf453647e7293f68f35173d45486a

Fix possible crash with custom (add-on defined) icons

This change is a simple null check on the ID provided to icon_set_image() which
appears to be a legitimate value for the ID when used by some addins
(discovered with PowerSave shortly after syncing to main).

Differential Revision: https://developer.blender.org/D9866

Reviewed by: Julian Eisel

===================================================================

M	source/blender/editors/interface/interface_icons.c

===================================================================

diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index 08e9ea31b53..899f4a6ddb1 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -1416,7 +1416,7 @@ static void icon_set_image(const bContext *C,
   const bool delay = prv_img->rect[size] != NULL;
   icon_create_rect(prv_img, size);
 
-  if (use_job && BKE_previewimg_id_supports_jobs(id)) {
+  if (use_job && (!id || BKE_previewimg_id_supports_jobs(id))) {
     /* Job (background) version */
     ED_preview_icon_job(
         C, prv_img, id, prv_img->rect[size], prv_img->w[size], prv_img->h[size], delay);



More information about the Bf-blender-cvs mailing list