Page MenuHome

Add nullptr check in case a mesh has no shader
ClosedPublic

Authored by Charles Flèche (charlesf) on Apr 4 2022, 1:53 AM.

Details

Summary

While working on https://developer.blender.org/D14537 I don't deal with shaders yet. Turns out cycles was crashing because of a pointer always expected to be non null. This patch adds a nullptr check to prevent a potential crash.

Diff Detail

Repository
rB Blender

Event Timeline

Charles Flèche (charlesf) requested review of this revision.Apr 4 2022, 1:53 AM
Charles Flèche (charlesf) created this revision.
Brecht Van Lommel (brecht) requested changes to this revision.Apr 4 2022, 1:46 PM

Thanks, but it should use scene->default_surface instead of leaving tri_shader uninitialized.

This revision now requires changes to proceed.Apr 4 2022, 1:46 PM
  • Ensure default_surface is applied on tri with no defined shader

I wonder if there is a real gain of accessing *shader_ptr rather than shader operator[]. Is so, any reason the smooth buffer is not accessed through a pointer as well ?

No good reason, I'll change the code to work like that.

This revision is now accepted and ready to land.Apr 11 2022, 2:38 PM