Fix T89581: Cycles crash rendering some OpenVDB files with inactive voxels

Print an error message instead.
This commit is contained in:
Brecht Van Lommel 2021-07-01 21:18:55 +02:00
parent 0c84939117
commit 82466ca2e5
Notes: blender-bot 2023-02-14 08:07:50 +01:00
Referenced by issue #89581, Crash in preparation steps of rendering on some frames of a Sprites file - seems related to OpenVDB and/or TBB
1 changed files with 8 additions and 1 deletions

View File

@ -16,6 +16,7 @@
#include "render/image_vdb.h"
#include "util/util_logging.h"
#include "util/util_openvdb.h"
#ifdef WITH_OPENVDB
@ -61,7 +62,13 @@ struct ToNanoOp {
bool operator()(const openvdb::GridBase::ConstPtr &grid)
{
if constexpr (!std::is_same_v<GridType, openvdb::MaskGrid>) {
nanogrid = nanovdb::openToNanoVDB(FloatGridType(*openvdb::gridConstPtrCast<GridType>(grid)));
try {
nanogrid = nanovdb::openToNanoVDB(
FloatGridType(*openvdb::gridConstPtrCast<GridType>(grid)));
}
catch (const std::exception &e) {
VLOG(1) << "Error converting OpenVDB to NanoVDB grid: " << e.what();
}
return true;
}
else {