Add MaybeNullWhen to TryGetDalamudPlugin

This commit is contained in:
Liza 2023-10-17 10:10:48 +02:00
parent e59d291f04
commit 2f6ef354c4
Signed by: liza
GPG Key ID: 7199F8D727D55F67

View File

@ -1,6 +1,7 @@
using Dalamud.Plugin; using Dalamud.Plugin;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection; using System.Reflection;
using Dalamud.Plugin.Services; using Dalamud.Plugin.Services;
@ -55,7 +56,8 @@ public sealed class DalamudReflector : IDisposable
.GetMethod("Get")!.Invoke(null, BindingFlags.Default, null, Array.Empty<object>(), null)!; .GetMethod("Get")!.Invoke(null, BindingFlags.Default, null, Array.Empty<object>(), null)!;
} }
public bool TryGetDalamudPlugin(string internalName, out IDalamudPlugin? instance, bool suppressErrors = false, public bool TryGetDalamudPlugin(string internalName, [MaybeNullWhen(false)] out IDalamudPlugin instance,
bool suppressErrors = false,
bool ignoreCache = false) bool ignoreCache = false)
{ {
if (!ignoreCache && _pluginCache.TryGetValue(internalName, out instance)) if (!ignoreCache && _pluginCache.TryGetValue(internalName, out instance))