From 7da10ac9243e3af6410859696b8ae9727c267797 Mon Sep 17 00:00:00 2001 From: Gene Walters Date: Mon, 26 Apr 2021 16:17:14 -0700 Subject: [PATCH] Null check when removing old component variables. This is used for graph properties that have been deleted. --- .../Code/Editor/Components/EditorScriptCanvasComponent.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Gems/ScriptCanvas/Code/Editor/Components/EditorScriptCanvasComponent.cpp b/Gems/ScriptCanvas/Code/Editor/Components/EditorScriptCanvasComponent.cpp index f49ace2e58..ba82f58889 100644 --- a/Gems/ScriptCanvas/Code/Editor/Components/EditorScriptCanvasComponent.cpp +++ b/Gems/ScriptCanvas/Code/Editor/Components/EditorScriptCanvasComponent.cpp @@ -528,8 +528,10 @@ namespace ScriptCanvasEditor { const auto& variableId = varConfig.m_graphVariable.GetVariableId(); + // We only add component sourced graph properties to the script canvas component, so if this variable was switched to a graph-only property remove it. + // Also be sure to remove this variable if it's been deleted entirely. auto graphVariable = graphVarData.FindVariable(variableId); - if (!graphVariable->IsComponentProperty()) + if (!graphVariable || !graphVariable->IsComponentProperty()) { oldVariableIds.push_back(variableId); }