Null checks

This commit is contained in:
Liza 2023-08-23 08:10:47 +02:00
parent 81d6f268ee
commit 283001258f
Signed by: liza
GPG Key ID: 7199F8D727D55F67
2 changed files with 7 additions and 6 deletions

View File

@ -23,7 +23,8 @@ internal sealed class Inventory
public IEnumerable<InventoryItem> GetAllItems() =>
((IEnumerable)_getAllInventories.Invoke(_delegate, Array.Empty<object>())!)
.Cast<IEnumerable>()
.SelectMany(x => x.Cast<object>())
.Select(x => new InventoryItem(x))
.SelectMany(x => x.Cast<object?>())
.Where(x => x != null)
.Select(x => new InventoryItem(x!))
.ToList();
}

View File

@ -1,8 +1,8 @@
namespace Influx.SubmarineTracker;
public class SubmarineStats
public sealed class SubmarineStats
{
public string Name { get; init; }
public int Id { get; init; }
public ushort Level { get; init; }
public required string Name { get; init; }
public required int Id { get; init; }
public required ushort Level { get; init; }
}