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

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