private static final JSFunction parseHTML = new JSFunction() {
public Object call(Context cx, Scriptable thisObj, Scriptable ctorObj, Object[] args) throws JavaScriptException {
- if (args == null || args.length != 1) return null;
+ if (args == null || args.length != 1 || args[0] == null) return null;
try {
if (args[0] instanceof ByteStream) {
return HTML.parseReader(new InputStreamReader(((ByteStream)args[0]).getInputStream()));