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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user