Fix bogus nullability errors from Rider.

None of these are actual nullability warnings but they make Rider shut up so.
This commit is contained in:
Pieter-Jan Briers
2020-08-25 17:48:23 +02:00
parent 584e540bb2
commit 7890c1b39c
5 changed files with 7 additions and 7 deletions

View File

@@ -102,7 +102,7 @@ namespace Robust.Client.Graphics.Clyde
foreach (var tile in chunk)
{
var regionMaybe = _tileDefinitionManager.TileAtlasRegion(tile.Tile);
if (!regionMaybe.HasValue)
if (regionMaybe == null)
{
continue;
}

View File

@@ -263,7 +263,7 @@ namespace Robust.Client.UserInterface.Controls
else
{
var metrics = font.GetCharMetrics(chr, UIScale);
if (!metrics.HasValue)
if (metrics == null)
{
continue;
}

View File

@@ -240,7 +240,7 @@ namespace Robust.Shared.Prototypes
foreach (var (stream, filePath) in yamlStreams)
{
for (var i = 0; i < stream.Documents.Count; i++)
for (var i = 0; i < stream!.Documents.Count; i++)
{
try
{

View File

@@ -238,7 +238,7 @@ namespace Robust.Shared.Serialization
/// </exception>
public virtual T ReadDataField<T>(string name)
{
if (TryReadDataField(name, out T val))
if (TryReadDataField<T>(name, out var val))
{
return val;
}

View File

@@ -173,7 +173,7 @@ namespace Robust.Shared.Serialization
{
if (Reading) // read
{
if (_context != null && _context.TryGetCachedField(name, out T theValue))
if (_context != null && _context.TryGetCachedField<T>(name, out var theValue))
{
// Itermediate field so value doesn't get reset to default(T) if this fails.
value = theValue;
@@ -256,7 +256,7 @@ namespace Robust.Shared.Serialization
{
if (Reading)
{
if (_context != null && _context.TryGetCachedField(name, out TTarget theValue))
if (_context != null && _context.TryGetCachedField<TTarget>(name, out var theValue))
{
// Itermediate field so value doesn't get reset to default(T) if this fails.
value = theValue;
@@ -307,7 +307,7 @@ namespace Robust.Shared.Serialization
throw new InvalidOperationException("Cannot use ReadDataField while not reading.");
}
if (_context != null && _context.TryGetCachedField(name, out T val))
if (_context != null && _context.TryGetCachedField<T>(name, out var val))
{
return val;
}