From 92d943937a557fb7052b6c11095550cf8ff52524 Mon Sep 17 00:00:00 2001 From: Raymond Date: Sun, 22 Aug 2021 07:58:06 -0400 Subject: [PATCH] Throw meaningful exceptions, not Linq exceptions --- Dalamud/Plugin/Internal/LocalPlugin.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dalamud/Plugin/Internal/LocalPlugin.cs b/Dalamud/Plugin/Internal/LocalPlugin.cs index 7c3c9ef25..82240b2dd 100644 --- a/Dalamud/Plugin/Internal/LocalPlugin.cs +++ b/Dalamud/Plugin/Internal/LocalPlugin.cs @@ -57,7 +57,9 @@ namespace Dalamud.Plugin.Internal this.pluginAssembly = this.loader.LoadDefaultAssembly(); // InvalidOperationException - this.pluginType = this.pluginAssembly.GetTypes().First(type => type.IsAssignableTo(typeof(IDalamudPlugin))); + this.pluginType = this.pluginAssembly.GetTypes().FirstOrDefault(type => type.IsAssignableTo(typeof(IDalamudPlugin))); + if (this.pluginType == default) + throw new Exception("Nothing inherits from IDalamudPlugin"); assemblyVersion = this.pluginAssembly.GetName().Version; }