Skip to content

Commit

Permalink
Added an extra layer of safety just to be sure
Browse files Browse the repository at this point in the history
  • Loading branch information
Nrosa01 committed May 1, 2024
1 parent 5afc731 commit 9ad1d4e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/assets/models/particle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ class ParticleModel {
static used_names = new Set();

constructor(display_name, data, blockly_workspace = null) {
// Just to be sure
if (ParticleModel.used_names.has(data.name)) {
// console.error("Name already in use", data.name);
data.name = ParticleModel.createName();
}

ParticleModel.used_names.add(data.name);
// console.log("Used names", ParticleModel.used_names)

this.display_name = display_name;
this.data = data;
Expand All @@ -19,7 +24,6 @@ class ParticleModel {
ParticleModel.count++;
}

// console.log("Name", `Particle ${ParticleModel.count}`)
return `Particle ${ParticleModel.count}`;
}

Expand Down

0 comments on commit 9ad1d4e

Please sign in to comment.