From b0ca58dc52b3f405b0de7fe79511ad25bd6543f7 Mon Sep 17 00:00:00 2001
From: Arkerthan <arkerthan@mailbox.org>
Date: Sun, 11 Sep 2022 18:15:09 +0200
Subject: [PATCH] Fix surgery outro giving errors if the default description is
 empty

---
 js/medicine/surgery/structural/amputation.js | 9 +++++++--
 js/medicine/surgery/voice/mute.js            | 9 +++++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/js/medicine/surgery/structural/amputation.js b/js/medicine/surgery/structural/amputation.js
index c6375989784..efc3f2b4a56 100644
--- a/js/medicine/surgery/structural/amputation.js
+++ b/js/medicine/surgery/structural/amputation.js
@@ -217,8 +217,13 @@ App.Medicine.Surgery.Reactions.Amputate = class extends App.Medicine.Surgery.Sim
 		const {He, him} = getPronouns(slave);
 
 		if (slave.behavioralFlaw === "arrogant") {
-			reaction.longReaction.last()
-				.push(`<span class="flaw break">${He} can hardly be arrogant relying on others to feed, bathe and carry ${him}.</span>`);
+			const r = `<span class="flaw break">${He} can hardly be arrogant relying on others to feed, bathe and carry ${him}.</span>`;
+			if (reaction.longReaction.length > 0) {
+				reaction.longReaction.last()
+					.push(r);
+			} else {
+				reaction.longReaction.push([r]);
+			}
 			slave.behavioralFlaw = "none";
 		}
 
diff --git a/js/medicine/surgery/voice/mute.js b/js/medicine/surgery/voice/mute.js
index 6d1f5195f89..ba9062fcb60 100644
--- a/js/medicine/surgery/voice/mute.js
+++ b/js/medicine/surgery/voice/mute.js
@@ -40,8 +40,13 @@ App.Medicine.Surgery.Reactions.Mute = class extends App.Medicine.Surgery.SimpleR
 		const {He} = getPronouns(slave);
 
 		if (slave.behavioralFlaw === "bitchy") {
-			reaction.longReaction.last()
-				.push(`<span class="green">${He} can hardly make sharp remarks without a voice.</span>`);
+			const r = `<span class="green">${He} can hardly make sharp remarks without a voice.</span>`;
+			if (reaction.longReaction.length > 0) {
+				reaction.longReaction.last()
+					.push(r);
+			} else {
+				reaction.longReaction.push([r]);
+			}
 			slave.behavioralFlaw = "none";
 		}
 
-- 
GitLab