Fix T40482: Cycles matlib file crashes

it's possible that runtime optimizer would call get_attribute
with NULL renderstate. As per documentation, it's valid to
return false in that cases and in worst case we'll just miss
some possible optimization.

Supporting such cases would require some bigger changes to
Cycles since attributes are only set to up for the kernel
after shader compilation.

Thanks Brecht for review!
This commit is contained in:
Sergey Sharybin
2014-06-05 02:29:48 +06:00
parent 9b3efa912a
commit dc2daf7a67

View File

@@ -754,6 +754,9 @@ bool OSLRenderServices::get_background_attribute(KernelGlobals *kg, ShaderData *
bool OSLRenderServices::get_attribute(void *renderstate, bool derivatives, ustring object_name,
TypeDesc type, ustring name, void *val)
{
if (renderstate == NULL)
return false;
ShaderData *sd = (ShaderData *)renderstate;
KernelGlobals *kg = sd->osl_globals;
bool is_curve;