Action Editor: Preemptive fix for null-pointer dereference

A few weeks ago, I got a random crash while testing som edge cases
(IIRC, it was trying to assign an action with no active object),
which I haven't been able to reproduce since then. This commit though
adds some extra sanity checks here, as a user may try to assign an
action to an animdata block which did not have an action already.
This commit is contained in:
Joshua Leung 2015-04-17 01:10:27 +12:00
parent 0b691563ea
commit 6589d07c8f
1 changed files with 3 additions and 1 deletions

View File

@ -1225,7 +1225,9 @@ static void rna_SpaceDopeSheetEditor_action_update(Main *UNUSED(bmain), Scene *s
/* set action */
if (adt) {
/* fix id-count of action we're replacing */
id_us_min(&adt->action->id);
if (adt->action) {
id_us_min(&adt->action->id);
}
/* assign new action, and adjust the usercounts accordingly */
adt->action = saction->action;