Particle edit: Fix crash when trying to edit particles without cache
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Jun 2018 11:51:57 +0000 (13:51 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 6 Jun 2018 11:54:39 +0000 (13:54 +0200)
Particles in EMITTER mode needs to have cache.

source/blender/draw/modes/particle_mode.c

index dacd4b728345e2775e34071c8bec6cd46628288b..19c3ddd4b502206587e1868117e8b1c53c07b1d1 100644 (file)
@@ -183,6 +183,12 @@ static void particle_cache_populate(void *vedata, Object *object)
        Object *object_orig = DEG_get_original_object(object);
        PTCacheEdit *edit = PE_create_current(
                draw_ctx->depsgraph, scene_orig, object_orig);
+       if (edit == NULL) {
+               /* Happens when trying to edit particles in EMITTER mode without
+                * having them cached.
+                */
+               return;
+       }
        /* NOTE: We need to pass evaluated particle system, which we need
         * to find first.
         */