Fix T52027: OSL getattribute() crash, when optimizer calls it before rendering.

This commit is contained in:
Brecht Van Lommel 2017-07-11 22:39:51 +02:00
parent 3f39719b5d
commit 29ec0b1162
Notes: blender-bot 2023-02-14 06:48:43 +01:00
Referenced by issue #52058, Jumping to keyframe causes Blender to freeze indefinitely
Referenced by issue #52059, Blender crash when enabling OpenSubdiv
Referenced by issue #52027, Crash in OSL getattribute call
1 changed files with 1 additions and 1 deletions

View File

@ -824,7 +824,7 @@ bool OSLRenderServices::get_background_attribute(KernelGlobals *kg, ShaderData *
bool OSLRenderServices::get_attribute(OSL::ShaderGlobals *sg, bool derivatives, ustring object_name,
TypeDesc type, ustring name, void *val)
{
if(sg->renderstate == NULL)
if(sg == NULL || sg->renderstate == NULL)
return false;
ShaderData *sd = (ShaderData *)(sg->renderstate);