Fix #136047: Cycles OSL gettextureinfo crash with missing image

Missing null pointer check.

Pull Request: https://projects.blender.org/blender/blender/pulls/136075
This commit is contained in:
Brecht Van Lommel
2025-03-17 16:18:31 +01:00
committed by Brecht Van Lommel
parent 44c01ff893
commit f896f7ffc3

View File

@@ -1598,19 +1598,26 @@ bool OSLRenderServices::get_texture_info(OSLUStringHash filename,
OSLUStringHash * /*errormessage*/)
{
OSLTextureHandle *handle = (OSLTextureHandle *)texture_handle;
/* No texture info for other texture types. */
if (handle && handle->type != OSLTextureHandle::OIIO) {
return false;
}
/* Get texture info from OpenImageIO. */
OSL::TextureSystem *ts = m_texturesys;
if (handle->oiio_handle) {
return ts->get_texture_info(
handle->oiio_handle, texture_thread_info, subimage, to_ustring(dataname), datatype, data);
if (handle) {
/* No texture info for other texture types. */
if (handle->type != OSLTextureHandle::OIIO) {
return false;
}
if (handle->oiio_handle) {
/* Get texture info from OpenImageIO. */
return ts->get_texture_info(handle->oiio_handle,
texture_thread_info,
subimage,
to_ustring(dataname),
datatype,
data);
}
}
/* Get texture info from OpenImageIO, slower using filename. */
return ts->get_texture_info(
to_ustring(filename), subimage, to_ustring(dataname), datatype, data);
}