From 6e9883932e9fc98edfd864abed869ea306fb8c7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BE=D0=BB=D0=BE=D0=B4=D1=8F?= Date: Sun, 20 Nov 2022 02:10:51 +0300 Subject: [PATCH] Fix map --- AirPlaneWithRadar/AirPlaneWithRadar/MapsCollection.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/AirPlaneWithRadar/AirPlaneWithRadar/MapsCollection.cs b/AirPlaneWithRadar/AirPlaneWithRadar/MapsCollection.cs index 74bac1e..6b49008 100644 --- a/AirPlaneWithRadar/AirPlaneWithRadar/MapsCollection.cs +++ b/AirPlaneWithRadar/AirPlaneWithRadar/MapsCollection.cs @@ -26,16 +26,15 @@ namespace AirPlaneWithRadar public void AddMap(string name, AbstractMap map) { - Keys.Add(name); + if (_mapStorages.ContainsKey(name)) + return; _mapStorages.Add(name, new MapWithSetPlainGeneric(_pictureWidth, _pictureHeight, map)); } public void DelMap(string name) { - if (!_mapStorages.ContainsKey(name)) - return; - Keys.Remove(name); + _mapStorages.Remove(name); }