Fix T58279: crush when load this scene _ with simple materials and simple objects.
authorBastien Montagne <montagne29@wanadoo.fr>
Fri, 30 Nov 2018 09:45:16 +0000 (10:45 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Fri, 30 Nov 2018 09:45:16 +0000 (10:45 +0100)
Not sure why eevee's light_cache is NULL in that file, but this can be
handled gracefully instead of crashing. ;)

source/blender/blenloader/intern/readfile.c

index 229d0d044233fac1fdabe873a996317ac5c1e5e1..acf6ead7d962fc1d5e4a88e02c387bf4f1b69c55 100644 (file)
@@ -6550,9 +6550,9 @@ static void direct_link_scene(FileData *fd, Scene *sce)
                else sce->eevee.light_cache = NULL;
        }
        else {
-               /* else read the cache from file. */
+               /* else try to read the cache from file. */
+               sce->eevee.light_cache = newdataadr(fd, sce->eevee.light_cache);
                if (sce->eevee.light_cache) {
-                       sce->eevee.light_cache = newdataadr(fd, sce->eevee.light_cache);
                        direct_link_lightcache(fd, sce->eevee.light_cache);
                }
        }