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 would then crash. Now just check if we actually have a cache. Pull Request: https://projects.blender.org/blender/blender/pulls/107537