From 359def2b61746eede76fe8d7d7847c9295a5190e Mon Sep 17 00:00:00 2001 From: Alain Bryden <2285037+alainbryden@users.noreply.github.com> Date: Wed, 24 Aug 2022 11:09:35 -0300 Subject: [PATCH] Don't stringify answer if already a string --- src/NetscriptFunctions/CodingContract.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/NetscriptFunctions/CodingContract.ts b/src/NetscriptFunctions/CodingContract.ts index 4f1f45221..93cd1b7b2 100644 --- a/src/NetscriptFunctions/CodingContract.ts +++ b/src/NetscriptFunctions/CodingContract.ts @@ -37,7 +37,7 @@ export function NetscriptCodingContract(): InternalAPI { throw new Error("The answer provided was not a number, string, or array"); // Convert answer to string. - const answerStr = JSON.stringify(answer); + const answerStr = typeof answer === 'string' ? answer : JSON.stringify(answer); const creward = contract.reward; if (creward === null) throw new Error("Somehow solved a contract that didn't have a reward");