Fix T94969: Crash in Volume to Mesh with 0 voxels

Checks if voxel amount or -size is <= 0 and if so, returns early.

Differential Revision: https://developer.blender.org/D15241
This commit is contained in:
Erik Abrahamsson 2022-06-20 20:12:44 +02:00
parent 9f8cc1bc34
commit 522dcc54af
Notes: blender-bot 2023-02-14 11:25:11 +01:00
Referenced by issue #99004, Geometry nodes Volume Cube crashes when volume is zero
Referenced by issue #98661, 3.2: Potential candidates for corrective releases
Referenced by issue #94969, Crash. Volume to mesh with 0 amount of voxels
1 changed files with 10 additions and 0 deletions

View File

@ -153,6 +153,16 @@ static Mesh *create_mesh_from_volume(GeometrySet &geometry_set, GeoNodeExecParam
}
const bke::VolumeToMeshResolution resolution = get_resolution_param(params);
if (resolution.mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_SIZE &&
resolution.settings.voxel_size <= 0.0f) {
return nullptr;
}
if (resolution.mode == VOLUME_TO_MESH_RESOLUTION_MODE_VOXEL_AMOUNT &&
resolution.settings.voxel_amount <= 0) {
return nullptr;
}
const Main *bmain = DEG_get_bmain(params.depsgraph());
BKE_volume_load(volume, bmain);