mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-19 06:03:50 +01:00
Merge pull request #4032 from alainbryden/patch-1
Coding Contracts: Don't stringify answer if already a string
This commit is contained in:
commit
e593216e77
@ -37,7 +37,7 @@ export function NetscriptCodingContract(): InternalAPI<ICodingContract> {
|
|||||||
throw new Error("The answer provided was not a number, string, or array");
|
throw new Error("The answer provided was not a number, string, or array");
|
||||||
|
|
||||||
// Convert answer to string.
|
// Convert answer to string.
|
||||||
const answerStr = JSON.stringify(answer);
|
const answerStr = typeof answer === 'string' ? answer : JSON.stringify(answer);
|
||||||
const creward = contract.reward;
|
const creward = contract.reward;
|
||||||
if (creward === null) throw new Error("Somehow solved a contract that didn't have a reward");
|
if (creward === null) throw new Error("Somehow solved a contract that didn't have a reward");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user