From a698daafffd2358efbb12514d98fba82ebf8573d Mon Sep 17 00:00:00 2001 From: Mike Tutkowski Date: Wed, 13 Aug 2014 10:53:37 -0600 Subject: [PATCH] Handle case where no storage tags exist yet --- ui/scripts/system.js | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index b65830158b2..5c49a1a632b 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -16897,18 +16897,25 @@ dataType: "json", success: function (json) { var item = json.liststoragetagsresponse.storagetag; - var tags = $.map(item, function (tag) { - return { - id: tag.name, - name: tag.name - }; - }); + var tags = []; + + if (item != null) + { + tags = $.map(item, function (tag) { + return { + id: tag.name, + name: tag.name + }; + }); + } + args.response.success({ data: tags }); }, error: function (XMLHttpResponse) { var errorMsg = parseXMLHttpResponse(XMLHttpResponse); + args.response.error(errorMsg); } });