Skip to content

Commit

Permalink
NPE in org.htmlunit.javascript.JavaScriptEngine.asJavaScriptException()
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Feb 11, 2025
1 parent 90032d5 commit b24a078
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

<body>
<release version="4.10.0" date="February xx, 2025" description="Chrome/Edge 132, Firefox 135, Javascript Errors, Bugfixes">
<action type="fix" dev="rbri">
NPE in org.htmlunit.javascript.JavaScriptEngine.asJavaScriptException().
</action>
<action type="update" dev="rbri">
Upgrade commons-logging to 1.3.5.
</action>
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/org/htmlunit/javascript/JavaScriptEngine.java
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,10 @@ public static RhinoException asJavaScriptException(final HtmlUnitScriptable scop
domException.setPrototype(scope.getPrototype(DOMException.class));

final EcmaError helper = ScriptRuntime.syntaxError("helper");
final String fileName = helper.sourceName().replaceFirst("script in (.*) from .*", "$1");
String fileName = helper.sourceName();
if (fileName != null) {
fileName = fileName.replaceFirst("script in (.*) from .*", "$1");
}
domException.setLocation(fileName, helper.lineNumber());

return new JavaScriptException(domException, fileName, helper.lineNumber());
Expand Down

0 comments on commit b24a078

Please sign in to comment.