Fix crash when using content search in Visject surface

This commit is contained in:
Wojtek Figat
2024-06-03 10:54:22 +02:00
parent e0791eacad
commit f51a442357
2 changed files with 15 additions and 13 deletions

View File

@@ -2198,21 +2198,23 @@ namespace FlaxEditor.Surface.Archetypes
_combobox.ClearItems(); _combobox.ClearItems();
_tooltips.Clear(); _tooltips.Clear();
_functionNodesIds.Clear(); _functionNodesIds.Clear();
var nodes = Surface.Nodes; if (Surface != null && _signature != null)
var count = _signature != null ? nodes.Count : 0;
for (int i = 0; i < count; i++)
{ {
if (nodes[i] is VisualScriptFunctionNode functionNode) var nodes = Surface.Nodes;
for (int i = 0; i < nodes.Count; i++)
{ {
// Get if function signature matches the event signature if (nodes[i] is VisualScriptFunctionNode functionNode)
functionNode.GetSignature(out var functionSig);
if (IsValidFunctionSignature(ref functionSig))
{ {
if (functionNode.ID == handlerFunctionNodeId) // Get if function signature matches the event signature
toSelect = _functionNodesIds.Count; functionNode.GetSignature(out var functionSig);
_functionNodesIds.Add(functionNode.ID); if (IsValidFunctionSignature(ref functionSig))
_tooltips.Add(functionNode.TooltipText); {
_combobox.AddItem(functionSig.ToString()); if (functionNode.ID == handlerFunctionNodeId)
toSelect = _functionNodesIds.Count;
_functionNodesIds.Add(functionNode.ID);
_tooltips.Add(functionNode.TooltipText);
_combobox.AddItem(functionSig.ToString());
}
} }
} }
} }

View File

@@ -35,7 +35,7 @@ namespace FlaxEditor.Surface.Elements
ParentNode.ValuesChanged += OnNodeValuesChanged; ParentNode.ValuesChanged += OnNodeValuesChanged;
// Disable slider if surface doesn't allow it // Disable slider if surface doesn't allow it
if (!ParentNode.Surface.CanLivePreviewValueChanges) if (ParentNode.Surface != null && !ParentNode.Surface.CanLivePreviewValueChanges)
_slideSpeed = 0.0f; _slideSpeed = 0.0f;
} }