fix(PluginManager): allow LoadError state in Unload()

This commit is contained in:
goat 2021-07-16 23:16:48 +02:00
parent d43f07dc04
commit bf158c9386
No known key found for this signature in database
GPG key ID: F18F057873895461

View file

@ -315,13 +315,11 @@ namespace Dalamud.Plugin.Internal
/// <param name="reloading">Unload while reloading.</param> /// <param name="reloading">Unload while reloading.</param>
public void Unload(bool reloading = false) public void Unload(bool reloading = false)
{ {
// Allowed: Loaded // Allowed: Loaded, LoadError(we are cleaning this up while we're at it)
switch (this.State) switch (this.State)
{ {
case PluginState.InProgress: case PluginState.InProgress:
throw new InvalidPluginOperationException($"Unable to unload {this.Name}, already working"); throw new InvalidPluginOperationException($"Unable to unload {this.Name}, already working");
case PluginState.LoadError:
throw new InvalidPluginOperationException($"Unable to unload {this.Name}, load previously faulted, unload first");
case PluginState.Unloaded: case PluginState.Unloaded:
throw new InvalidPluginOperationException($"Unable to unload {this.Name}, already unloaded"); throw new InvalidPluginOperationException($"Unable to unload {this.Name}, already unloaded");
case PluginState.UnloadError: case PluginState.UnloadError: