Skip to content

Commit

Permalink
copy info object to prevent editing the original
Browse files Browse the repository at this point in the history
  • Loading branch information
MineFact committed Jan 26, 2024
1 parent 0f33f9e commit 86bb73d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/struct/core/buildteam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ export default class BuildTeam {


// BuildTeamInfo is a json array with one object per buildteam
const info = this.network.buildTeamInfo.filter((info: any) => info.APIKey == this.apiKey)[0];
let info = this.network.buildTeamInfo.filter((info: any) => info.APIKey == this.apiKey)[0];

// Make a copy of the object
info = JSON.parse(JSON.stringify(info));

if(info == null){
console.log("Build Team Info could not be found by API Key in loadBuildTeamInfo(). API Key: " + this.apiKey + " | API Keys in BuildTeamInfo: " + this.network.buildTeamInfo.map((info: any) => info.APIKey).join(", "))
Expand Down

0 comments on commit 86bb73d

Please sign in to comment.