From: Robert Konigsberg Date: Sat, 7 Jan 2012 14:54:45 +0000 (-0500) Subject: Bug in the function that splits variables. X-Git-Tag: v1.0.0~367 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=3d8093fa2d6b9db4991204ac6a066f4eb424e3d6;p=dygraphs.git Bug in the function that splits variables. --- 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; }