From f0aa69ff3acff189bf19ea86601f669830426bf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 29 Jan 2024 14:23:35 +0100 Subject: [PATCH] Fix #117620: Crash when moving bones to linked bone collection `add_or_move_to_collection_bcoll()` already checked for linked collections, but the caller didn't properly do a `nullptr` check. Adding that check fixed the crash. The next commit will actually disable the menu for such collections, so that it's clear in the UI that it cannot work. --- source/blender/editors/armature/bone_collections.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/blender/editors/armature/bone_collections.cc b/source/blender/editors/armature/bone_collections.cc index ea5e87d7f9c..048d071eb34 100644 --- a/source/blender/editors/armature/bone_collections.cc +++ b/source/blender/editors/armature/bone_collections.cc @@ -929,6 +929,10 @@ static int add_or_move_to_collection_exec(bContext *C, bArmature *arm = static_cast(ob->data); BoneCollection *target_bcoll = add_or_move_to_collection_bcoll(op, arm); + if (!target_bcoll) { + /* add_or_move_to_collection_bcoll() already reported the reason. */ + return OPERATOR_CANCELLED; + } bool made_any_changes = false; bool had_bones_to_assign = false;