Enable nullability in Content.Server (#3685)

This commit is contained in:
DrSmugleaf
2021-03-16 15:50:20 +01:00
committed by GitHub
parent 90fec0ed24
commit a5ade526b7
306 changed files with 1616 additions and 1441 deletions

View File

@@ -1,8 +1,9 @@
using System.Collections.Generic;
using Content.Shared.Prototypes.Cargo;
using Content.Shared.GameTicking;
using System.Diagnostics.CodeAnalysis;
using Content.Server.Cargo;
using Content.Server.GameObjects.Components.Cargo;
using Content.Shared.GameTicking;
using Content.Shared.Prototypes.Cargo;
using Robust.Shared.GameObjects;
namespace Content.Server.GameObjects.EntitySystems
@@ -104,12 +105,12 @@ namespace Content.Server.GameObjects.EntitySystems
/// <summary>
/// Returns whether the account exists, eventually passing the account in the out parameter.
/// </summary>
public bool TryGetBankAccount(int id, out CargoBankAccount account)
public bool TryGetBankAccount(int id, [NotNullWhen(true)] out CargoBankAccount? account)
{
return _accountsDict.TryGetValue(id, out account);
}
public bool TryGetOrderDatabase(int id, out CargoOrderDatabase database)
public bool TryGetOrderDatabase(int id, [NotNullWhen(true)] out CargoOrderDatabase? database)
{
return _databasesDict.TryGetValue(id, out database);
}
@@ -182,7 +183,7 @@ namespace Content.Server.GameObjects.EntitySystems
{
foreach (var comp in ComponentManager.EntityQuery<CargoOrderDatabaseComponent>(true))
{
if (!comp.ConnectedToDatabase || comp.Database.Id != id)
if (comp.Database == null || comp.Database.Id != id)
continue;
comp.Dirty();
}