diff --git a/source/blender/animrig/ANIM_action.hh b/source/blender/animrig/ANIM_action.hh index f92fc5fb0fd..7a8037cfb21 100644 --- a/source/blender/animrig/ANIM_action.hh +++ b/source/blender/animrig/ANIM_action.hh @@ -17,6 +17,7 @@ namespace blender::animrig { /** * Get (or add relevant data to be able to do so) F-Curve from the given Action, * for the given Animation Data block. This assumes that all the destinations are valid. + * \param ptr can be a null pointer. */ FCurve *action_fcurve_ensure(Main *bmain, bAction *act, diff --git a/source/blender/animrig/intern/action.cc b/source/blender/animrig/intern/action.cc index 378df112b91..833d0cbfdb8 100644 --- a/source/blender/animrig/intern/action.cc +++ b/source/blender/animrig/intern/action.cc @@ -60,19 +60,21 @@ FCurve *action_fcurve_ensure(Main *bmain, fcu->rna_path = BLI_strdup(rna_path); fcu->array_index = array_index; - if (U.autokey_flag & AUTOKEY_FLAG_XYZ2RGB) { + if (U.autokey_flag & AUTOKEY_FLAG_XYZ2RGB && ptr != nullptr) { /* For Loc/Rot/Scale and also Color F-Curves, the color of the F-Curve in the Graph Editor, * is determined by the array index for the F-Curve. */ PropertyRNA *prop; PointerRNA r_ptr; - RNA_path_resolve_property(ptr, rna_path, &r_ptr, &prop); - PropertySubType prop_subtype = RNA_property_subtype(prop); - if (ELEM(prop_subtype, PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR, PROP_COORDS)) { - fcu->color_mode = FCURVE_COLOR_AUTO_RGB; - } - else if (ELEM(prop_subtype, PROP_QUATERNION)) { - fcu->color_mode = FCURVE_COLOR_AUTO_YRGB; + const bool resolved = RNA_path_resolve_property(ptr, rna_path, &r_ptr, &prop); + if (resolved) { + PropertySubType prop_subtype = RNA_property_subtype(prop); + if (ELEM(prop_subtype, PROP_TRANSLATION, PROP_XYZ, PROP_EULER, PROP_COLOR, PROP_COORDS)) { + fcu->color_mode = FCURVE_COLOR_AUTO_RGB; + } + else if (ELEM(prop_subtype, PROP_QUATERNION)) { + fcu->color_mode = FCURVE_COLOR_AUTO_YRGB; + } } }