[Bf-blender-cvs] [3f3910966a3] universal-scene-description: USD import: invalid UsdUVTexture input crash.
Michael Kowalski
noreply at git.blender.org
Mon Aug 15 22:33:34 CEST 2022
Commit: 3f3910966a3eb2550ec4fa01180b70010c383096
Author: Michael Kowalski
Date: Sun Aug 14 15:58:02 2022 -0400
Branches: universal-scene-description
https://developer.blender.org/rB3f3910966a3eb2550ec4fa01180b70010c383096
USD import: invalid UsdUVTexture input crash.
Fixed crash when accessing invalud texture file
inputs.
===================================================================
M source/blender/io/usd/intern/usd_reader_material.cc
===================================================================
diff --git a/source/blender/io/usd/intern/usd_reader_material.cc b/source/blender/io/usd/intern/usd_reader_material.cc
index 1ebd88cfbc4..a63667faca7 100644
--- a/source/blender/io/usd/intern/usd_reader_material.cc
+++ b/source/blender/io/usd/intern/usd_reader_material.cc
@@ -719,6 +719,12 @@ void USDMaterialReader::load_tex_image(const pxr::UsdShadeShader &usd_shader,
/* Try to load the texture image. */
pxr::UsdShadeInput file_input = usd_shader.GetInput(usdtokens::file);
+ if (!file_input) {
+ std::cerr << "WARNING: Couldn't get file input for USD shader " << usd_shader.GetPath()
+ << std::endl;
+ return;
+ }
+
/* File input may have a connected source, e.g., if it's been overridden by
* an input on the mateial. */
if (file_input.HasConnectedSource()) {
@@ -735,12 +741,6 @@ void USDMaterialReader::load_tex_image(const pxr::UsdShadeShader &usd_shader,
}
}
- if (!file_input) {
- std::cerr << "WARNING: Couldn't get file input for USD shader " << usd_shader.GetPath()
- << std::endl;
- return;
- }
-
pxr::VtValue file_val;
if (!file_input.Get(&file_val) || !file_val.IsHolding<pxr::SdfAssetPath>()) {
std::cerr << "WARNING: Couldn't get file input value for USD shader " << usd_shader.GetPath()
More information about the Bf-blender-cvs
mailing list