Исправления

This commit is contained in:
Валерия Никифорова 2022-12-09 18:44:57 +04:00
parent c707897b00
commit 3895ad8a7e
3 changed files with 12 additions and 8 deletions

View File

@ -165,24 +165,23 @@ namespace AccordionBus
{
return false;
}
var otherMap = other as AbstractMap;
if (otherMap == null)
if (other == null)
{
return false;
}
if (_width != otherMap._width)
if (_width != other._width)
{
return false;
}
if (_height != otherMap._height)
if (_height != other._height)
{
return false;
}
if (_size_x != otherMap._size_x)
if (_size_x != other._size_x)
{
return false;
}
if (_size_y != otherMap._size_y)
if (_size_y != other._size_y)
{
return false;
}
@ -190,7 +189,7 @@ namespace AccordionBus
{
for (int j = 0; j < _map.GetLength(1); j++)
{
if (_map[i, j] != otherMap._map[i, j])
if (_map[i, j] != other._map[i, j])
{
return false;
}

View File

@ -157,6 +157,11 @@ namespace AccordionBus
_logger.LogWarning($"Ошибка переполнения хранилища: {ex.Message}");
MessageBox.Show($"Ошибка переполнения хранилища: {ex.Message}", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (ArgumentException ex)
{
_logger.LogWarning($"Ошибка добавления: {ex.Message}");
MessageBox.Show($"Ошибка добавления: {ex.Message}");
}
catch (Exception ex)
{
_logger.LogWarning($"Неизвестная ошибка: {ex.Message}");

View File

@ -52,7 +52,7 @@ namespace AccordionBus
// Проверка на уникальность
if (_places.Contains(bus))
{
return -1;
throw new ArgumentException("Объект с такими характеристиками уже существует в наборе.");
}
//проверка позиции
if (Count == _maxCount)