[Bf-blender-cvs] [9f371c5ca30] sculpt-mode-features: fix crash with openvdb filters in case the openvdb grid is invalid

Martin Felke noreply at git.blender.org
Thu Apr 11 15:02:49 CEST 2019


Commit: 9f371c5ca306d8562fae4ac7c7597e669be71e73
Author: Martin Felke
Date:   Thu Apr 11 15:01:00 2019 +0200
Branches: sculpt-mode-features
https://developer.blender.org/rB9f371c5ca306d8562fae4ac7c7597e669be71e73

fix crash with openvdb filters in case the openvdb grid is invalid

invalid can mean the grid is empty or the grid class is not "LevelSet",
happens usually when the volume is empty

===================================================================

M	intern/openvdb/intern/openvdb_level_set.cc

===================================================================

diff --git a/intern/openvdb/intern/openvdb_level_set.cc b/intern/openvdb/intern/openvdb_level_set.cc
index c95cbceb10f..0205d142108 100644
--- a/intern/openvdb/intern/openvdb_level_set.cc
+++ b/intern/openvdb/intern/openvdb_level_set.cc
@@ -91,6 +91,15 @@ void OpenVDBLevelSet::OpenVDB_volume_to_mesh(OpenVDBVolumeToMeshData *mesh,	cons
 }
 
 void OpenVDBLevelSet::OpenVDB_level_set_filter(OpenVDBLevelSet_FilterType filter_type, int width, int iterations, int filter_bias){
+
+	if (!this->grid) {
+		return;
+	}
+
+	if (this->grid && this->grid->getGridClass() != openvdb::GRID_LEVEL_SET) {
+		return;
+	}
+
 	openvdb::tools::LevelSetFilter<openvdb::FloatGrid> filter(*this->grid);
 	filter.setSpatialScheme((openvdb::math::BiasedGradientScheme)filter_bias);
 	switch (filter_type) {



More information about the Bf-blender-cvs mailing list