From 9fc201edd526a7619c9c4114c4fb5e4d8048ee57 Mon Sep 17 00:00:00 2001 From: "nboyd%atg.com" Date: Tue, 12 Dec 2000 14:51:55 +0000 Subject: [PATCH] Fix ArrayIndexOutOfBoundsException on "new RegExp()" --- js/rhino/org/mozilla/javascript/regexp/NativeRegExp.java | 2 +- js/rhino/src/org/mozilla/javascript/regexp/NativeRegExp.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/rhino/org/mozilla/javascript/regexp/NativeRegExp.java b/js/rhino/org/mozilla/javascript/regexp/NativeRegExp.java index 8a7b3ab1496..fd71059632a 100644 --- a/js/rhino/org/mozilla/javascript/regexp/NativeRegExp.java +++ b/js/rhino/org/mozilla/javascript/regexp/NativeRegExp.java @@ -176,7 +176,7 @@ public class NativeRegExp extends ScriptableObject implements Function { Object[] args, Function funObj) { NativeRegExp thisObj = (NativeRegExp) thisVal; // XXX check cast - if (args[0] instanceof NativeRegExp) { + if (args.length > 0 && args[0] instanceof NativeRegExp) { if (args.length > 1) { // report error throw NativeGlobal.constructError( diff --git a/js/rhino/src/org/mozilla/javascript/regexp/NativeRegExp.java b/js/rhino/src/org/mozilla/javascript/regexp/NativeRegExp.java index 8a7b3ab1496..fd71059632a 100644 --- a/js/rhino/src/org/mozilla/javascript/regexp/NativeRegExp.java +++ b/js/rhino/src/org/mozilla/javascript/regexp/NativeRegExp.java @@ -176,7 +176,7 @@ public class NativeRegExp extends ScriptableObject implements Function { Object[] args, Function funObj) { NativeRegExp thisObj = (NativeRegExp) thisVal; // XXX check cast - if (args[0] instanceof NativeRegExp) { + if (args.length > 0 && args[0] instanceof NativeRegExp) { if (args.length > 1) { // report error throw NativeGlobal.constructError(