[Bf-blender-cvs] [85dd4d4e3ba] sybren-usd: USD: prevent crash when writing hair system with empty pathcache
Sybren A. Stüvel
noreply at git.blender.org
Fri Jul 19 11:15:30 CEST 2019
Commit: 85dd4d4e3baa5b33260a5f06c6fbb782a6aa10fb
Author: Sybren A. Stüvel
Date: Fri Jul 19 11:14:26 2019 +0200
Branches: sybren-usd
https://developer.blender.org/rB85dd4d4e3baa5b33260a5f06c6fbb782a6aa10fb
USD: prevent crash when writing hair system with empty pathcache
Not sure what causes `psys->pathcache` to be `nullptr` in the first place,
but at least this prevents Blender from crashing.
===================================================================
M source/blender/usd/intern/usd_writer_hair.cc
===================================================================
diff --git a/source/blender/usd/intern/usd_writer_hair.cc b/source/blender/usd/intern/usd_writer_hair.cc
index af0d23addcd..37bc6a00c9b 100644
--- a/source/blender/usd/intern/usd_writer_hair.cc
+++ b/source/blender/usd/intern/usd_writer_hair.cc
@@ -18,6 +18,11 @@ USDHairWriter::USDHairWriter(const USDExporterContext &ctx) : USDAbstractWriter(
void USDHairWriter::do_write(HierarchyContext &context)
{
ParticleSystem *psys = context.particle_system;
+ ParticleCacheKey **cache = psys->pathcache;
+ if (cache == nullptr) {
+ return;
+ }
+
pxr::UsdTimeCode timecode = get_export_time_code();
printf("\033[34;1mHAIR writer\033[0m writing %s %s\n",
@@ -35,7 +40,6 @@ void USDHairWriter::do_write(HierarchyContext &context)
curve_point_counts.reserve(psys->totpart);
colors.reserve(psys->totpart);
- ParticleCacheKey **cache = psys->pathcache;
ParticleCacheKey *strand;
for (int strand_index = 0; strand_index < psys->totpart; ++strand_index) {
strand = cache[strand_index];
More information about the Bf-blender-cvs
mailing list