Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authormakowalski <makowalski@nvidia.com>2021-03-10 02:06:04 +0300
committermakowalski <makowalski@nvidia.com>2021-03-10 02:06:04 +0300
commitd2eccca2375a1c464b22dd65bc32bc9699a617ee (patch)
tree7b3ae368da91334c6e861968cff5d979f4a25a8c /source
parentc700505d4f85da9e3b24fafc94030b9a6e0718c9 (diff)
USD Import: read attributes null data guard.
Checking for null pointer to avoid crash when custom data allocation fails.
Diffstat (limited to 'source')
-rw-r--r--source/blender/io/usd/intern/usd_reader_mesh.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc
index b5e0cac18cf..3daaa1c07a0 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -499,13 +499,22 @@ void USDMeshReader::read_attributes(Mesh *mesh,
type_size = sizeof(pxr::GfVec3i);
data = (void *)idata.cdata();
}
+ else {
+ continue;
+ }
void *cdata = CustomData_get_layer_named(cd, cd_type, name);
if (!cdata) {
cdata = CustomData_add_layer_named(cd, cd_type, CD_DEFAULT, NULL, num, name);
}
- memcpy(cdata, data, num * type_size);
+
+ if (cdata) {
+ memcpy(cdata, data, num * type_size);
+ }
+ else {
+ std::cerr << "WARNING: Couldn't add custom data layer " << name << std::endl;
+ }
}
}