Skip to content

Commit 1898697

Browse files
committed
empty check
1 parent 8ae8bc3 commit 1898697

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/main/java/org/htmlunit/javascript/host/dom/NodeList.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,10 @@ public void forEach(final Object callback) {
152152
"Foreach callback '" + JavaScriptEngine.toString(callback) + "' is not a function");
153153
}
154154

155+
if (getElements().size() == 0) {
156+
return;
157+
}
158+
155159
final WebClient client = getWindow().getWebWindow().getWebClient();
156160
final HtmlUnitContextFactory cf = client.getJavaScriptEngine().getContextFactory();
157161

0 commit comments

Comments
 (0)