From 101cb11973c64b6643b2cb19656c801a7258bec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 4 Mar 2011 19:06:05 +0000 Subject: [PATCH] Change Base.read to not return an object if only null is provided. --- lib/bootstrap.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/bootstrap.js b/lib/bootstrap.js index 26eef2f6..ccde8615 100644 --- a/lib/bootstrap.js +++ b/lib/bootstrap.js @@ -201,9 +201,13 @@ new function() { read: function(args, index, length) { var index = index || 0, length = length || args.length - index; - if (length == 1 && args[index] instanceof this) { - return args[index]; - } else if (length != 0) { + if (length == 1) { + var arg = args[index]; + // Return null when only null was provided + if (arg instanceof this || arg == null) + return arg; + } + if (length > 0) { var obj = new this(this.dont); obj = obj.initialize.apply(obj, index > 0 || length < args.length ? Array.prototype.slice.call(args, index, index + length)