allow deletion of chats which are not started by me

This commit is contained in:
Felix Hartmann (PEA3-Fe-FI)
2021-09-23 09:41:56 +02:00
parent e1ea49bf71
commit 1b3d133657

View File

@@ -102,8 +102,12 @@ namespace PolyChat
public void CloseChat(string IP, bool wasConnected = true) public void CloseChat(string IP, bool wasConnected = true)
{ {
Connections[IP].Close(); Debug.WriteLine($"Deleting connection with IP:{IP}");
Connections.Remove(IP); if (IP != null && Connections.ContainsKey(IP))
{
Connections[IP].Close();
Connections.Remove(IP);
}
CloseChatUI(IP,wasConnected); CloseChatUI(IP,wasConnected);
} }