From ea9a1d2c4746b4ebba7f73ffd042f0881b17e9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Tue, 8 Mar 2011 17:08:30 +0000 Subject: [PATCH] Fix Base.read() to correctly read existing objects even when length > 1. --- src/paper.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/paper.js b/src/paper.js index aab5ec73..71b71d80 100644 --- a/src/paper.js +++ b/src/paper.js @@ -54,12 +54,10 @@ Base.inject({ read: function(args, index, length) { var index = index || 0, length = length || args.length - index; - if (length <= 1) { - var arg = args[index]; - // Return null when nothing was provided - if (arg instanceof this || arg == null) - return arg; - } + var arg = args[index]; + // Return null when nothing was provided + if (arg instanceof this || arg == null && length <= 1) + return arg; var obj = new this(this.dont); obj = obj.initialize.apply(obj, index > 0 || length < args.length ? Array.prototype.slice.call(args, index, index + length)