* Check for null format argument in Date.format()

This commit is contained in:
hns 2005-11-22 16:57:12 +00:00
parent b64c845258
commit f84ab79675

View file

@ -1059,7 +1059,7 @@ public final class RhinoCore implements ScopeProvider {
Date date = new Date((long) ScriptRuntime.toNumber(thisObj)); Date date = new Date((long) ScriptRuntime.toNumber(thisObj));
SimpleDateFormat df = null; SimpleDateFormat df = null;
if (args.length > 0 && args[0] != Undefined.instance) { if (args.length > 0 && args[0] != Undefined.instance && args[0] != null) {
if (args.length > 1 && args[1] instanceof NativeJavaObject) { if (args.length > 1 && args[1] instanceof NativeJavaObject) {
Object locale = ((NativeJavaObject) args[1]).unwrap(); Object locale = ((NativeJavaObject) args[1]).unwrap();
if (locale instanceof Locale) { if (locale instanceof Locale) {
@ -1125,4 +1125,3 @@ public final class RhinoCore implements ScopeProvider {
} }
} }