fixed getParameterString to handle null/undefined values correctly. r=elemoine (closes #2157)

git-svn-id: http://svn.openlayers.org/trunk/openlayers@9573 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
ahocevar
2009-07-20 21:11:03 +00:00
parent 2c8ec98643
commit 82cbb8c7cb
2 changed files with 10 additions and 3 deletions

View File

@@ -608,8 +608,12 @@ OpenLayers.Util.getParameterString = function(params) {
if (typeof value == 'object' && value.constructor == Array) {
/* value is an array; encode items and separate with "," */
var encodedItemArray = [];
var item;
for (var itemIndex=0, len=value.length; itemIndex<len; itemIndex++) {
encodedItemArray.push(encodeURIComponent(value[itemIndex]));
item = value[itemIndex];
encodedItemArray.push(encodeURIComponent(
(item === null || item === undefined) ? "" : item)
);
}
encodedValue = encodedItemArray.join(",");
}