From a633155b4fc00583102e9d099442f84f52da4e7b Mon Sep 17 00:00:00 2001
From: lowercasedonkey <lowercasedonkey@gmail.com>
Date: Mon, 27 Jul 2020 19:53:51 -0400
Subject: [PATCH] svorn fix

---
 src/interaction/rename.js | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/interaction/rename.js b/src/interaction/rename.js
index faaa4a952f1..280e830d518 100644
--- a/src/interaction/rename.js
+++ b/src/interaction/rename.js
@@ -90,18 +90,19 @@ App.UI.SlaveInteract.rename = function(slave, {oldName = "", oldSurname = ""} =
 		/* Wife's surname reaction */
 		if (oldSurname !== slave.slaveSurname) {
 			if (slave.relationship >= 5) {
-				let _i = V.slaveIndices[slave.relationshipTarget];
-				if (!_i) {
+				const slaveWife = getSlave(slave.relationshipTarget);
+				if (!slaveWife) {
 					r.push(`<span class="red">Error, relationshipTarget not found.</span>`);
-				}
-				if (V.slaves[_i].slaveSurname) {
-					const {wife2} = getPronouns(V.slaves[_i]).appendSuffix('2');
-					if (slave.slaveSurname === V.slaves[_i].slaveSurname) {
-						r.push(`${He}'s touched that ${he} now shares a surname with ${his} ${wife2} ${V.slaves[_i].slaveName} ${V.slaves[_i].slaveSurname}, and is <span class="mediumaquamarine">more confident than ever</span> that you intend to keep them together in marital bliss.`);
-						slave.trust += 5;
-					} else if (oldSurname === V.slaves[_i].slaveSurname) {
-						r.push(`${He}'s concerned that ${he} no longer shares a surname with ${his} ${wife2} ${V.slaves[_i].slaveName} ${V.slaves[_i].slaveSurname}, and is <span class="gold">very worried</span> that you might be considering splitting them up.`);
-						slave.trust -= 5;
+				} else {
+					if (slaveWife.slaveSurname) {
+						const {wife2} = getPronouns(slaveWife).appendSuffix('2');
+						if (slave.slaveSurname === slaveWife.slaveSurname) {
+							r.push(`${He}'s touched that ${he} now shares a surname with ${his} ${wife2} ${slaveWife.slaveName} ${slaveWife.slaveSurname}, and is <span class="mediumaquamarine">more confident than ever</span> that you intend to keep them together in marital bliss.`);
+							slave.trust += 5;
+						} else if (oldSurname === slaveWife.slaveSurname) {
+							r.push(`${He}'s concerned that ${he} no longer shares a surname with ${his} ${wife2} ${slaveWife.slaveName} ${slaveWife.slaveSurname}, and is <span class="gold">very worried</span> that you might be considering splitting them up.`);
+							slave.trust -= 5;
+						}
 					}
 				}
 			}
-- 
GitLab