From 3d8093fa2d6b9db4991204ac6a066f4eb424e3d6 Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Sat, 7 Jan 2012 09:54:45 -0500 Subject: [PATCH] Bug in the function that splits variables. --- auto_tests/misc/local.html | 8 +++++--- experimental/palette/index.js | 8 +++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/auto_tests/misc/local.html b/auto_tests/misc/local.html index 616f59e..a7efaf6 100644 --- a/auto_tests/misc/local.html +++ b/auto_tests/misc/local.html @@ -49,9 +49,11 @@ var query = window.location.search.substring(1); var args = {}; var vars = query.split("&"); - for (var i = 0;i < vars.length; i++) { - var pair = vars[i].split("="); - args[pair[0]] = pair[1]; + for (var i = 0; i < vars.length; i++) { + if (vars[i].length > 0) { + var pair = vars[i].split("="); + args[pair[0]] = pair[1]; + } } return args; } diff --git a/experimental/palette/index.js b/experimental/palette/index.js index 64f5316..8f9491e 100644 --- a/experimental/palette/index.js +++ b/experimental/palette/index.js @@ -32,9 +32,11 @@ Index.splitVariables = function() { // http://www.idealog.us/2006/06/javascript_ var query = window.location.search.substring(1); var args = {}; var vars = query.split("&"); - for (var i = 0;i < vars.length; i++) { - var pair = vars[i].split("="); - args[pair[0]] = pair[1]; + for (var i = 0; i < vars.length; i++) { + if (vars[i].length > 0) { + var pair = vars[i].split("="); + args[pair[0]] = pair[1]; + } } return args; } -- 2.7.4