Fixing NullReferenceExcepction in renaming Node

When I have no selected node and I press F2 key, NullReferenceException appears in method RenameSelectedNode(). I added not null condition, it is working now. Debugged in VS2017.
This commit is contained in:
Toomix
2018-08-01 08:50:55 +02:00
committed by GitHub
parent a259ab9541
commit 7dbef77687

View File

@@ -295,8 +295,11 @@ namespace mRemoteNG.UI.Controls
public void RenameSelectedNode()
{
_allowEdit = true;
SelectedItem.BeginEdit();
if (SelectedItem != null)
{
_allowEdit = true;
SelectedItem.BeginEdit();
}
}
public void DeleteSelectedNode()
@@ -440,4 +443,4 @@ namespace mRemoteNG.UI.Controls
}
#endregion
}
}
}