Skip to content

Commit

Permalink
Removed major bug causing an infinite loop.
Browse files Browse the repository at this point in the history
In add_ghost() there was an infinite loop because the iteration variable didn't grow.
  • Loading branch information
Filipdominik committed Jul 28, 2023
1 parent c99523d commit 0f6a7ef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion wheel.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,9 +551,10 @@ function remove_ghost(ghost) {

function add_ghost() {
let ghostName = 'New Ghost';
let iteration = 0;
let iteration = 1;
while (ghostsInfo[ghostName] != undefined) {
ghostName = `New Ghost ${iteration}`;
iteration += 1;
}
ghostsInfo[ghostName] = { color: '#FFFFFF', text_color: '#0f0000' };
ghostSelection.push(ghostName);
Expand Down

0 comments on commit 0f6a7ef

Please sign in to comment.