Closed Bug 795813 Opened 12 years ago Closed 5 years ago

NPE in org.mozilla.javascript.regexp.NativeRegExp.reportWarning

Categories

(Rhino Graveyard :: Core, defect)

1.7R1
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INACTIVE

People

(Reporter: sideshowbarker, Unassigned)

Details

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.10 Safari/537.11

Steps to reproduce:

Called compileRegExp(Context cx, String source, String flags) on instance of org.mozilla.javascript.regexp.RegExpImpl with null Context.


Actual results:

NPE in org.mozilla.javascript.regexp.NativeRegExp.reportWarning


Expected results:

compileRegExp should gracefully handle the null-Context case.

I guess that means the conditional in reportWarning(Context cx, String messageId, String arg) should probably have a null check:

  if (cx != null || cx.hasFeature(Context.FEATURE_STRICT_MODE))
(In reply to Michael[tm] Smith from comment #0)
>   if (cx != null || cx.hasFeature(Context.FEATURE_STRICT_MODE))

er, of course that'd need to be && instead of || ...

Closing. Bug management is now done here:
https://github.com/mozilla/rhino

Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.