Fix respath null errors (#3989)

This commit is contained in:
Leon Friedrich
2023-05-01 16:11:07 +12:00
committed by GitHub
parent 4d26202cf5
commit 2efed72eba
4 changed files with 5 additions and 5 deletions

View File

@@ -12,7 +12,7 @@ namespace Robust.Client.ResourceManagement
/// <summary>
/// Fallback resource path if this one does not exist.
/// </summary>
public virtual ResPath Fallback => default;
public virtual ResPath? Fallback => null;
/// <summary>
/// Disposes this resource.

View File

@@ -43,7 +43,7 @@ namespace Robust.Client.ResourceManagement
{
Logger.Error(
$"Exception while loading resource {typeof(T)} at '{path}', resorting to fallback.\n{Environment.StackTrace}\n{e}");
return GetResource<T>(_resource.Fallback, false);
return GetResource<T>(_resource.Fallback.Value, false);
}
else
{
@@ -141,7 +141,7 @@ namespace Robust.Client.ResourceManagement
throw new InvalidOperationException($"Resource of type '{typeof(T)}' has no fallback.");
}
fallback = GetResource<T>(res.Fallback, useFallback: false);
fallback = GetResource<T>(res.Fallback.Value, useFallback: false);
_fallbacks.Add(typeof(T), fallback);
return (T) fallback;
}

View File

@@ -18,7 +18,7 @@ namespace Robust.Client.ResourceManagement
/// </summary>
public sealed class RSIResource : BaseResource
{
public override ResPath Fallback => new("/Textures/error.rsi");
public override ResPath? Fallback => new("/Textures/error.rsi");
public RSI RSI { get; private set; } = default!;

View File

@@ -14,7 +14,7 @@ namespace Robust.Client.ResourceManagement
public sealed class TextureResource : BaseResource
{
private OwnedTexture _texture = default!;
public override ResPath Fallback => new("/Textures/noSprite.png");
public override ResPath? Fallback => new("/Textures/noSprite.png");
public Texture Texture => _texture;