From 9f01264610f74723e527fdb623d112af9d0dd477 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 12 Aug 2010 16:39:23 +0000 Subject: bugfix: deleting NLA tracks with a keyframed text3d obdata would free the curve, missing type checks. --- source/blender/editors/space_nla/nla_channels.c | 42 ++++++++++++++----------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'source/blender/editors/space_nla') diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index 3e0ec5afac2..d834fb07ee7 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -384,20 +384,22 @@ static int nlaedit_add_tracks_exec (bContext *C, wmOperator *op) /* add tracks... */ for (ale= anim_data.first; ale; ale= ale->next) { - NlaTrack *nlt= (NlaTrack *)ale->data; - AnimData *adt= ale->adt; - - /* check if just adding a new track above this one, - * or whether we're adding a new one to the top of the stack that this one belongs to - */ - if (above_sel) { - /* just add a new one above this one */ - add_nlatrack(adt, nlt); - } - else if ((lastAdt == NULL) || (adt != lastAdt)) { - /* add one track to the top of the owning AnimData's stack, then don't add anymore to this stack */ - add_nlatrack(adt, NULL); - lastAdt= adt; + if(ale->type == ANIMTYPE_NLATRACK) { + NlaTrack *nlt= (NlaTrack *)ale->data; + AnimData *adt= ale->adt; + + /* check if just adding a new track above this one, + * or whether we're adding a new one to the top of the stack that this one belongs to + */ + if (above_sel) { + /* just add a new one above this one */ + add_nlatrack(adt, nlt); + } + else if ((lastAdt == NULL) || (adt != lastAdt)) { + /* add one track to the top of the owning AnimData's stack, then don't add anymore to this stack */ + add_nlatrack(adt, NULL); + lastAdt= adt; + } } } @@ -450,11 +452,13 @@ static int nlaedit_delete_tracks_exec (bContext *C, wmOperator *op) /* delete tracks */ for (ale= anim_data.first; ale; ale= ale->next) { - NlaTrack *nlt= (NlaTrack *)ale->data; - AnimData *adt= ale->adt; - - /* call delete on this track - deletes all strips too */ - free_nlatrack(&adt->nla_tracks, nlt); + if(ale->type == ANIMTYPE_NLATRACK) { + NlaTrack *nlt= (NlaTrack *)ale->data; + AnimData *adt= ale->adt; + + /* call delete on this track - deletes all strips too */ + free_nlatrack(&adt->nla_tracks, nlt); + } } /* free temp data */ -- cgit v1.2.3