From 15bc3d260d64b39d31a3102030088be347aa14fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 21 Jun 2022 15:26:03 +0200 Subject: Fix 2 for T98700: Crash when recursively nesting NLA meta strips When searching for the active NLA strip, avoid overwriting the found strip pointer with NULL if it was already found in a previous iteration. The active strip is searched for while looping over the NLA tracks. If the active strip was found on a previous track, and not on the current track, this would effectively set `actstrip = NULL`. This is now avoided. Another benefit is that the search for the active strip is stopped as soon as it's found, which should increase performance a tiny bit. --- source/blender/blenkernel/intern/nla.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index a6d2c78216a..1900ae2e9ad 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -311,7 +311,11 @@ static void update_active_track(AnimData *adt_dest, const AnimData *adt_source) if (track_source == adt_source->act_track) { adt_dest->act_track = track_dest; } - update_active_strip(adt_dest, track_dest, adt_source, track_source); + + /* Only search for the active strip if it hasn't been found yet. */ + if (adt_dest->actstrip == NULL && adt_source->actstrip != NULL) { + update_active_strip(adt_dest, track_dest, adt_source, track_source); + } track_dest = track_dest->next; } -- cgit v1.2.3