Fix crash opening some 2.4x .blend files with drivers or NLA editor

For example, outlinertest.blend from test240.zip.
This commit is contained in:
Brecht Van Lommel 2020-11-02 14:26:49 +01:00
parent 9e736fc984
commit 42f6aada98
Notes: blender-bot 2023-03-01 14:40:06 +01:00
Referenced by commit 565acb639c, WM: use the window associated with an area for initialization
2 changed files with 4 additions and 2 deletions

View File

@ -2527,7 +2527,9 @@ static void direct_link_ipo(BlendDataReader *reader, Ipo *ipo)
/* Undo generic endian switching. */
if (BLO_read_requires_endian_switch(reader)) {
BLI_endian_switch_int16(&ipo->blocktype);
BLI_endian_switch_int16(&icu->driver->blocktype);
if (icu->driver != NULL) {
BLI_endian_switch_int16(&icu->driver->blocktype);
}
}
}
}

View File

@ -148,7 +148,7 @@ static void nla_init(struct wmWindowManager *wm, ScrArea *area)
/* init dopesheet data if non-existent (i.e. for old files) */
if (snla->ads == NULL) {
snla->ads = MEM_callocN(sizeof(bDopeSheet), "NlaEdit DopeSheet");
snla->ads->source = (ID *)WM_window_get_active_scene(wm->winactive);
snla->ads->source = (wm->winactive) ? (ID *)WM_window_get_active_scene(wm->winactive) : NULL;
}
ED_area_tag_refresh(area);