summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework/InternalExtensions.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI/Framework/InternalExtensions.cs')
-rw-r--r--src/StardewModdingAPI/Framework/InternalExtensions.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/StardewModdingAPI/Framework/InternalExtensions.cs b/src/StardewModdingAPI/Framework/InternalExtensions.cs
index a2d589ff..2f6f7490 100644
--- a/src/StardewModdingAPI/Framework/InternalExtensions.cs
+++ b/src/StardewModdingAPI/Framework/InternalExtensions.cs
@@ -41,6 +41,14 @@ namespace StardewModdingAPI.Framework
foreach (EventHandler handler in handlers.Cast<EventHandler>())
{
+ // handle SMAPI exiting
+ if (monitor.IsExiting)
+ {
+ monitor.Log($"SMAPI shutting down: aborting {name} event.", LogLevel.Warn);
+ return;
+ }
+
+ // raise event
try
{
handler.Invoke(sender, args ?? EventArgs.Empty);