diff --git a/code/tag.cpp b/code/tag.cpp
index 518b7d56d..574c447c7 100644
--- a/code/tag.cpp
+++ b/code/tag.cpp
@@ -347,7 +347,10 @@ void TagClass::Delete_All(void)
/// The global flag that just changed.
void TagClass::Timer_Global_Reset(int global)
{
- Trigger->Reset_Global_Linked_Timed_Events(global);
+ // A tag outlives a destroyed trigger with no link to take its place.
+ if (Trigger != nullptr) {
+ Trigger->Reset_Global_Linked_Timed_Events(global);
+ }
}
@@ -357,7 +360,9 @@ void TagClass::Timer_Global_Reset(int global)
/// The local variable that just changed.
void TagClass::Timer_Local_Reset(int local)
{
- Trigger->Reset_Local_Linked_Timed_Events(local);
+ if (Trigger != nullptr) {
+ Trigger->Reset_Local_Linked_Timed_Events(local);
+ }
}
diff --git a/manual/changes/tag-timer-reset-without-trigger.md b/manual/changes/tag-timer-reset-without-trigger.md
new file mode 100644
index 000000000..c2fd6b3d8
--- /dev/null
+++ b/manual/changes/tag-timer-reset-without-trigger.md
@@ -0,0 +1,12 @@
+---
+title: Survive a variable change while a tag has lost its trigger
+category: fix
+release: 0.2.0
+targets:
+- type: system
+ id: trigger-springing
+ effect: changed
+credit: [gibbo101]
+---
+
+A tag whose trigger has been destroyed keeps a null trigger when the destroyed one had no linked trigger to take its place. A trigger action that set a local or global variable then restarted every tag's timed events through that null trigger and crashed the game. The reset now skips a tag without a trigger, so the action completes and the other tags' timers restart as before.