fix(client-ui): resolve Medium code-review finding (Client.UI-002)

Guard the two nullable child VM dereferences (BrowseTree at ConnectAsync
and History at ViewHistoryForSelectedNode) with != null checks, matching
the guarding style already used for Subscriptions and Alarms nearby.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Joseph Doherty
2026-05-22 07:25:47 -04:00
parent 2816c76c2b
commit 55c2a5a209

View File

@@ -252,7 +252,7 @@ public partial class MainWindowViewModel : ObservableObject
}
// Load root nodes
await BrowseTree.LoadRootsAsync();
if (BrowseTree != null) await BrowseTree.LoadRootsAsync();
// Restore saved subscriptions
if (_savedSubscribedNodes.Count > 0 && Subscriptions != null)
@@ -330,7 +330,7 @@ public partial class MainWindowViewModel : ObservableObject
if (SelectedTreeNodes.Count == 0 || !IsConnected) return;
var node = SelectedTreeNodes[0];
History.SelectedNodeId = node.NodeId;
if (History != null) History.SelectedNodeId = node.NodeId;
SelectedTabIndex = 3; // History tab
}