Fix T79770: Crash opening 2.83 .blend with linked collection containing greasepencil object in 2.91
The scene was null and could not be patched.
This commit is contained in:
parent
d1057890c4
commit
f94e322ab7
Notes:
blender-bot
2023-02-14 10:29:30 +01:00
Referenced by issue #79770, Crash opening 2.83 .blend with linked collection containing greasepencil object in 2.91
|
@ -188,17 +188,19 @@ void do_versions_after_linking_290(Main *bmain, ReportList *UNUSED(reports))
|
|||
|
||||
/* Patch first frame for old files. */
|
||||
Scene *scene = bmain->scenes.first;
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
if (ob->type != OB_GPENCIL) {
|
||||
continue;
|
||||
}
|
||||
bGPdata *gpd = ob->data;
|
||||
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
|
||||
bGPDframe *gpf = gpl->frames.first;
|
||||
if (gpf && gpf->framenum > scene->r.sfra) {
|
||||
bGPDframe *gpf_dup = BKE_gpencil_frame_duplicate(gpf);
|
||||
gpf_dup->framenum = scene->r.sfra;
|
||||
BLI_addhead(&gpl->frames, gpf_dup);
|
||||
if (scene != NULL) {
|
||||
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
|
||||
if (ob->type != OB_GPENCIL) {
|
||||
continue;
|
||||
}
|
||||
bGPdata *gpd = ob->data;
|
||||
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
|
||||
bGPDframe *gpf = gpl->frames.first;
|
||||
if (gpf && gpf->framenum > scene->r.sfra) {
|
||||
bGPDframe *gpf_dup = BKE_gpencil_frame_duplicate(gpf);
|
||||
gpf_dup->framenum = scene->r.sfra;
|
||||
BLI_addhead(&gpl->frames, gpf_dup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue