Fix #113400: USD transform cache crash on invalid prim.

Updated CacheReader_open_usd_object() to issue a warning and
return early if the given object path does not refer to a
valid prim on the USD stage, to avoid crashing when attempting
to create a reader from an invalid prim.

Pull Request: https://projects.blender.org/blender/blender/pulls/113524
This commit is contained in:
Michael Kowalski
2023-10-11 16:21:19 +02:00
committed by Michael Kowalski
parent 73c35dbc22
commit f4124b4e20

View File

@@ -553,6 +553,11 @@ CacheReader *CacheReader_open_usd_object(CacheArchiveHandle *handle,
pxr::UsdPrim prim = archive->stage()->GetPrimAtPath(pxr::SdfPath(object_path));
if (!prim) {
WM_reportf(RPT_WARNING, "USD Import: unable to open cache reader for object %s", object_path);
return nullptr;
}
if (reader) {
USD_CacheReader_free(reader);
}