Фикс ObjNotFndEx в компании
This commit is contained in:
parent
3cac227c53
commit
7baa0393e0
@ -1,4 +1,5 @@
|
||||
using Battleship.Drawnings;
|
||||
using Battleship.Exceptions;
|
||||
|
||||
namespace Battleship.CollectionGenericObjects;
|
||||
/// <summary>
|
||||
@ -94,8 +95,12 @@ public abstract class AbstractCompany
|
||||
SetObjectsPosition();
|
||||
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
|
||||
{
|
||||
DrawningShip? obj = _collection?.Get(i);
|
||||
obj?.DrawTransport(graphics);
|
||||
try
|
||||
{
|
||||
DrawningShip? obj = _collection?.Get(i);
|
||||
obj?.DrawTransport(graphics);
|
||||
}
|
||||
catch (ObjectNotFoundException) { };
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Battleship.Drawnings;
|
||||
using Battleship.Exceptions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -50,8 +51,12 @@ public class ShipDocks : AbstractCompany
|
||||
{
|
||||
if (count < _collection.Count)
|
||||
{
|
||||
_collection?.Get(count)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
_collection?.Get(count)?.SetPosition(ix, iy);
|
||||
try
|
||||
{
|
||||
_collection?.Get(count)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
||||
_collection?.Get(count)?.SetPosition(ix, iy);
|
||||
}
|
||||
catch (ObjectNotFoundException){}
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user