From 3637e2d104656c57e43e2b9effaf91f39a72d56c Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 2 May 2023 13:14:05 +0200 Subject: [PATCH] Fix: crash baking empty rigid body world Found investigating #107420. Steps to reproduce were: - remove all objects from the scene - add rigid body world - bake - crash BKE_ptcache_bake would assume a cache can always be found, but with an empty rigid body world this is not the case -- accessing flags woud then crash. Now just check if we actually have a cache. --- source/blender/blenkernel/intern/pointcache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index a211d76c9b0..50957617754 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -3330,7 +3330,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker) } /* clear baking flag */ - if (pid) { + if (pid && cache) { cache->flag &= ~(PTCACHE_BAKING | PTCACHE_REDO_NEEDED); cache->flag |= PTCACHE_SIMULATION_VALID; if (bake) { -- 2.30.2