From 4f83c191a8f5acc93b3c0502e2cc20fe64f31688 Mon Sep 17 00:00:00 2001
From: Svornost <11434-svornost@users.noreply.gitgud.io>
Date: Sat, 15 Aug 2020 16:46:04 -0700
Subject: [PATCH] don't attempt to record slave-specific income on the PC
 object

---
 src/js/economyJS.js | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/js/economyJS.js b/src/js/economyJS.js
index 3b520bae0e8..ab6cc26a67e 100644
--- a/src/js/economyJS.js
+++ b/src/js/economyJS.js
@@ -2299,7 +2299,7 @@ globalThis.cashX = function(cost, what, who) {
 		}
 
 		// record the slave, if available
-		if (typeof who !== 'undefined') {
+		if (typeof who !== 'undefined' && who.ID !== -1) {
 			who.lastWeeksCashIncome += cost;
 			who.lifetimeCashIncome += cost;
 		}
@@ -2323,7 +2323,7 @@ globalThis.cashX = function(cost, what, who) {
 		}
 
 		// record the slave, if available
-		if (typeof who !== 'undefined') {
+		if (typeof who !== 'undefined' && who.ID !== -1) {
 			if (what === "slaveTransfer") {
 				who.slaveCost = cost;
 			} else {
@@ -2362,7 +2362,7 @@ globalThis.repX = function(rep, what, who) {
 	// These are all scaled relative to current rep except when recording the who, to keep comparisons between slaves possible across times. This quite drastically reduces rep income at high levels of rep and only slightly at low levels.
 	if (rep > 0) {
 		// record the slave, if available
-		if (typeof who !== 'undefined') {
+		if (typeof who !== 'undefined' && who.ID !== -1) {
 			who.lastWeeksRepIncome += rep;
 			who.lifetimeRepIncome += rep;
 		}
@@ -2386,7 +2386,7 @@ globalThis.repX = function(rep, what, who) {
 		}
 
 		// record the slave, if available
-		if (typeof who !== 'undefined') {
+		if (typeof who !== 'undefined' && who.ID !== -1) {
 			who.lastWeeksRepExpenses += rep;
 			who.lifetimeRepExpenses += rep;
 		}
-- 
GitLab