more anti-NaN

This commit is contained in:
Laetitia (O-01-67) 2023-03-05 16:51:53 -05:00 committed by GitHub
parent 860fd733cb
commit fe80a3f1f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -1290,8 +1290,12 @@ if(enabledMods.includes(loonaMod) && enabledMods.includes(fireMod) && enabledMod
for(i = 0; i < adjacentCoords.length; i++) {
var newPixel = pixelMap[pixel.x+adjacentCoords[i][0]]?.[pixel.y+adjacentCoords[i][1]];
if(newPixel) {
newPixel.charge ??= 0;
if(isNaN(newPixel.charge)) { newPixel.charge = 0 };
try {
newPixel.charge ??= 0;
doElectricity(newPixel)
if(isNaN(newPixel.charge)) { newPixel.charge = 0 };
} catch (error) {
if(error.toString().includes("Maximum call stack size exceeded")) {
return;