[FIX] devtools: fix crash while highlighting env

This commit fixes a crash that could happen in the keepEnvLit method
when passing through the env of the inspected component.
This commit is contained in:
Julien Carion (juca)
2023-07-20 11:18:28 +02:00
committed by Géry Debongnie
parent 9b1ec5dc0e
commit 6050827689
@@ -899,7 +899,7 @@ function keepEnvLit(details) {
alreadyMet.add(details.env.children[i].name);
} else {
let lastElement = details.env.children[i];
while (lastElement.children.at(-1).name === "[[Prototype]]") {
while (lastElement.children.at(-1)?.name === "[[Prototype]]") {
for (const [index, child] of lastElement.children.entries()) {
if (index < lastElement.children.length - 1) {
if (!alreadyMet.has(child.name)) {