Closed samreid closed 3 years ago
Similar problem in this code:
getNumericalControllerForIsotope( isotope ) {
let isotopeController = null;
this.numericalControllerList.forEach( controller => {
if ( controller.isotopeConfig.equals( isotope ) ) {
// Found it.
isotopeController = controller;
return isotopeController;
}
} );
return isotopeController;
}
I fixed the first bit of code by using standard C-style loops and using the overlap flag to drop out of them. I tested this via explicit overlap testing and fuzz testing.
The second bit of code doesn't seem to be used, so I simply deleted this.
I don't think a follow-up review is necessary so I'm just going to close this. @samreid - If you see this go by, you're welcome to review my changes and reopen if you think it's justified.
Similar to the problem in https://github.com/phetsims/gene-expression-essentials/issues/138, discovered in https://github.com/phetsims/chipper/issues/1033. It looks like this code is supposed to short circuit when a match is found, but it iterates over everything anyways.