Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 04d3872

Browse files
committed
[Debugger] Fixed an NRE exception in OVTVController.RemoveValue if node.Parent is null
Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1022024
1 parent 32e5a8c commit 04d3872

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValue/ObjectValueTreeViewController.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,12 +299,18 @@ void RemovePinnedWatch ()
299299
void RemoveValue (ObjectValueNode node)
300300
{
301301
var toplevel = node.Parent is RootObjectValueNode;
302-
int index = node.Parent.Children.IndexOf (node);
302+
int index;
303+
304+
if (node.Parent != null) {
305+
index = node.Parent.Children.IndexOf (node);
306+
} else {
307+
index = -1;
308+
}
303309

304310
UnregisterNode (node);
305311
OnEvaluationCompleted (node, new ObjectValueNode[0]);
306312

307-
if (AllowWatchExpressions && toplevel)
313+
if (AllowWatchExpressions && toplevel && index != -1)
308314
ExpressionRemoved?.Invoke (this, new ExpressionRemovedEventArgs (index, node.Name));
309315
}
310316

0 commit comments

Comments
 (0)