[Bf-blender-cvs] [eb87b1c8f6d] master: Cleanup: remove assignment from a NULL struct

Campbell Barton noreply at git.blender.org
Wed Jul 15 07:43:40 CEST 2020


Commit: eb87b1c8f6d56fc069752e252866bc134ee54e9d
Author: Campbell Barton
Date:   Wed Jul 15 15:37:03 2020 +1000
Branches: master
https://developer.blender.org/rBeb87b1c8f6d56fc069752e252866bc134ee54e9d

Cleanup: remove assignment from a NULL struct

Quiet ASAN 'member access within null pointer' warning.

While this doesn't crash, access to 'shading'
without checking if the 'v3d' would have.

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

M	source/blender/draw/engines/eevee/eevee_lookdev.c

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

diff --git a/source/blender/draw/engines/eevee/eevee_lookdev.c b/source/blender/draw/engines/eevee/eevee_lookdev.c
index 18365d69514..b89772441fa 100644
--- a/source/blender/draw/engines/eevee/eevee_lookdev.c
+++ b/source/blender/draw/engines/eevee/eevee_lookdev.c
@@ -107,9 +107,9 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata,
   EEVEE_EffectsInfo *effects = stl->effects;
   EEVEE_PrivateData *g_data = stl->g_data;
   const DRWContextState *draw_ctx = DRW_context_state_get();
-  View3D *v3d = draw_ctx->v3d;
-  View3DShading *shading = &v3d->shading;
-  Scene *scene = draw_ctx->scene;
+  /* The view will be NULL when rendering previews. */
+  const View3D *v3d = draw_ctx->v3d;
+  const Scene *scene = draw_ctx->scene;
 
   const bool probe_render = pinfo != NULL;
 
@@ -150,6 +150,7 @@ void EEVEE_lookdev_cache_init(EEVEE_Data *vedata,
   }
 
   if (LOOK_DEV_STUDIO_LIGHT_ENABLED(v3d)) {
+    const View3DShading *shading = &v3d->shading;
     StudioLight *sl = BKE_studiolight_find(shading->lookdev_light,
                                            STUDIOLIGHT_ORIENTATIONS_MATERIAL_MODE);
     if (sl && (sl->flag & STUDIOLIGHT_TYPE_WORLD)) {



More information about the Bf-blender-cvs mailing list