Skip to content

Commit 50f6495

Browse files
zeusongitCopilot
andauthored
DYN-9876: Handle null NodeModel, or failed focus command for the graph node manager extension. (#16733)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 7de9d5a commit 50f6495

File tree

1 file changed

+19
-6
lines changed

1 file changed

+19
-6
lines changed

src/GraphNodeManagerViewExtension/GraphNodeManagerViewModel.cs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,27 @@ internal void EnableEditing()
286286
internal void NodeSelect(object obj)
287287
{
288288
var nodeViewModel = obj as GridNodeViewModel;
289-
if (nodeViewModel == null) return;
289+
if (nodeViewModel == null || nodeViewModel.NodeModel == null) return;
290290

291-
// Select
292-
var command = new DynamoModel.SelectModelCommand(nodeViewModel.NodeModel.GUID, ModifierKeys.None);
293-
commandExecutive.ExecuteCommand(command, uniqueId, "GraphNodeManager");
291+
try
292+
{
293+
// Select
294+
var command = new DynamoModel.SelectModelCommand(nodeViewModel.NodeModel.GUID, ModifierKeys.None);
295+
commandExecutive.ExecuteCommand(command, uniqueId, "GraphNodeManager");
294296

295-
// Focus on selected
296-
viewModelCommandExecutive.FocusNodeCommand(nodeViewModel.NodeModel.GUID.ToString());
297+
// Focus on selected
298+
viewModelCommandExecutive.FocusNodeCommand(nodeViewModel.NodeModel.GUID.ToString());
299+
}
300+
catch
301+
{
302+
// Suppress exceptions from selection or focus commands.
303+
// Known failure scenarios include:
304+
// - Node not found (invalid GUID)
305+
// - UI not ready to process focus command
306+
// - Transient UI errors during command execution
307+
// These are intentionally ignored to prevent UI crashes or interruptions.
308+
return;
309+
}
297310
}
298311

299312
/// <summary>

0 commit comments

Comments
 (0)