From 3c14b35930dc32cb3b4330bf24cfa4fdf3bf6a8d Mon Sep 17 00:00:00 2001 From: Pavel_Sorokin Date: Fri, 2 Dec 2022 12:12:35 +0400 Subject: [PATCH] fix(2) --- Liner/Liner/DrawingObjectShip.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Liner/Liner/DrawingObjectShip.cs b/Liner/Liner/DrawingObjectShip.cs index 55f54e5..758177d 100644 --- a/Liner/Liner/DrawingObjectShip.cs +++ b/Liner/Liner/DrawingObjectShip.cs @@ -36,13 +36,18 @@ namespace Liner public bool Equals(IDrawingObject? other) { - if (other is not DrawingObjectShip otherShip) + if (other == null) + { + return false; + } + var otherShip = other as DrawingObjectShip; + if (otherShip == null) { return false; } var ship = _ship.Ship; var otherShipShip = otherShip._ship.Ship; - if (ship.GetType() != otherShipShip.GetType()) + if (ship.GetType().Name != otherShipShip.GetType().Name) { return false; } @@ -76,4 +81,6 @@ namespace Liner return true; } } + + } }