From c9beda86103e075d390f5f1c7cf36190c6fd5f63 Mon Sep 17 00:00:00 2001
From: ezsh <ezsh.junk@gmail.com>
Date: Sun, 19 May 2019 21:18:43 +0200
Subject: [PATCH] Declare HG and RC variables inside if's

Should make harder to make copy-paster mistakes.
---
 src/js/slaveListing.js | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js
index 344fa507603..eb0c8bc8bad 100644
--- a/src/js/slaveListing.js
+++ b/src/js/slaveListing.js
@@ -543,9 +543,9 @@ App.UI.SlaveList.penthousePage = function () {
 		let r = '';
 		const thisArcology = V.arcologies[0];
 
-		/** @type {App.Entity.SlaveState} */
-		const HG = V.HeadGirl;
-		if (HG) {
+		if (V.HeadGirl) {
+			/** @type {App.Entity.SlaveState} */
+			const HG = V.HeadGirl;
 			r += `<strong><u>${span(SlaveFullName(HG), "pink")}</u></strong> is serving as your Head Girl`;
 			if (thisArcology.FSEgyptianRevivalistLaw === 1) {
 				r += ' and Consort';
@@ -566,9 +566,9 @@ App.UI.SlaveList.penthousePage = function () {
 		}
 		r += '<br>';
 
-		/** @type {App.Entity.SlaveState} */
-		const RC = V.Recruiter;
-		if (RC) {
+		if (V.Recruiter) {
+			/** @type {App.Entity.SlaveState} */
+			const RC = V.Recruiter;
 			const p = getPronouns(RC);
 			r += `<strong><u>${span(SlaveFullName(RC), "pink")}</u></strong> is working `;
 			if (V.recruiterTarget !== "other arcologies") {
-- 
GitLab