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 committed by Thomas Dinges
parent e2c02655c7
commit 6d196b8f5e
Notes: blender-bot 2023-02-13 16:29:54 +01:00
Referenced by issue #94969, Crash. Volume to mesh with 0 amount of voxels
1 changed files with 10 additions and 0 deletions

View File

@ -151,6 +151,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);