Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add null checks before using element info #655

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,17 @@ private void removeGarbageSubTree(
// changes have been applied and after our caller (removeGarbageSubTree) removed another
// element that claims this element as its child, then that means this element should not be
// removed. It has been reparented, and recursion stops here.
if (elementInfo.parentElement != null &&
if (elementInfo != null && elementInfo.parentElement != null &&
elementToInfoMap.containsKey(elementInfo.parentElement)) {
return;
}

elementToInfoMap.remove(element);

for (int i = 0, N = elementInfo.children.size(); i < N; ++i) {
removeGarbageSubTree(elementToInfoMap, elementInfo.children.get(i));
if (elementInfo != null) {
for (int i = 0, N = elementInfo.children.size(); i < N; ++i) {
removeGarbageSubTree(elementToInfoMap, elementInfo.children.get(i));
}
}
}

Expand Down