From 1bbb0610ab3a9c680be6429309107ba865d83fdf Mon Sep 17 00:00:00 2001 From: Undeemiss Date: Tue, 31 May 2022 21:20:13 -0500 Subject: [PATCH] Fix bug where player not refunded hashes for invalid server targets --- src/Hacknet/HacknetHelpers.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Hacknet/HacknetHelpers.tsx b/src/Hacknet/HacknetHelpers.tsx index a3edd6d59..f9d0a7be2 100644 --- a/src/Hacknet/HacknetHelpers.tsx +++ b/src/Hacknet/HacknetHelpers.tsx @@ -497,7 +497,7 @@ export function purchaseHashUpgrade(player: IPlayer, upgName: string, upgTarget: const target = GetServer(upgTarget); if (target == null) { console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`); - return false; + throw new Error(`'${upgTarget}' is not a server.`); } if (!(target instanceof Server)) throw new Error(`'${upgTarget}' is not a normal server.`); @@ -513,7 +513,7 @@ export function purchaseHashUpgrade(player: IPlayer, upgName: string, upgTarget: const target = GetServer(upgTarget); if (target == null) { console.error(`Invalid target specified in purchaseHashUpgrade(): ${upgTarget}`); - return false; + throw new Error(`'${upgTarget}' is not a server.`); } if (!(target instanceof Server)) throw new Error(`'${upgTarget}' is not a normal server.`);