Anim: Fix crash when getting animdata from non-Action editor

Check the space type before casting its data to `SpaceAction*`.

Pull Request: https://projects.blender.org/blender/blender/pulls/127079
This commit is contained in:
Sybren A. Stüvel
2024-09-02 18:07:30 +02:00
parent 433278233e
commit ea72ed4502

View File

@@ -71,7 +71,12 @@ AnimData *ED_actedit_animdata_from_context(const bContext *C, ID **r_adt_id_owne
}
}
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
SpaceLink *space_data = CTX_wm_space_data(C);
if (!space_data || space_data->spacetype != SPACE_ACTION) {
return nullptr;
}
SpaceAction *saction = (SpaceAction *)space_data;
if (!saction) {
return nullptr;
}