diff options
author | Sybren A. Stüvel <sybren@blender.org> | 2021-10-14 13:55:22 +0300 |
---|---|---|
committer | Sybren A. Stüvel <sybren@blender.org> | 2021-10-14 13:55:33 +0300 |
commit | 56b35991bcdf8e8466e6e8b686fa2ebc49173114 (patch) | |
tree | a4e6a6b6b5f541df3fd90a5dfc7e2a72cebd8797 | |
parent | 42d79a6041a7e45efd9eee4613994bdb6090e028 (diff) |
Alembic: avoid crash when Cycles is not enabled
The Alembic/CacheFile modifier supports Cycles procedurals when Cycles
is configured to use experimental features; the check for this would
segfault on builds with `WITH_CYCLES=OFF`. This is now fixed by adding
an extra NULL check.
-rw-r--r-- | source/blender/blenkernel/intern/scene.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index a9a8cd93b1d..397bd430fd9 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -2787,6 +2787,12 @@ bool BKE_scene_uses_cycles_experimental_features(Scene *scene) PointerRNA scene_ptr; RNA_id_pointer_create(&scene->id, &scene_ptr); PointerRNA cycles_ptr = RNA_pointer_get(&scene_ptr, "cycles"); + + if (RNA_pointer_is_null(&cycles_ptr)) { + /* The pointer only exists if Cycles is enabled. */ + return false; + } + return RNA_enum_get(&cycles_ptr, "feature_set") == CYCLES_FEATURES_EXPERIMENTAL; } |