diff --git a/intern/cycles/kernel/osl/services.cpp b/intern/cycles/kernel/osl/services.cpp index b59df54beec..6d1708c7e42 100644 --- a/intern/cycles/kernel/osl/services.cpp +++ b/intern/cycles/kernel/osl/services.cpp @@ -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); }