From 0bddd96e25cb64a6537159ba34578b0a8ed7dd01 Mon Sep 17 00:00:00 2001 From: David Liu Date: Thu, 24 Mar 2016 17:58:06 +0800 Subject: [PATCH] Handle the cases guideline download failure with Test list download. This might causes an web console error if for some reason failed to download guideline etc. So with some polish and guard check. Closes-Bug: #1557291 Change-Id: I548c3e06b0bee6325f6d7e0cce8293ba53aff93c --- .../app/components/guidelines/guidelinesController.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/refstack-ui/app/components/guidelines/guidelinesController.js b/refstack-ui/app/components/guidelines/guidelinesController.js index 976869e3..665f3260 100644 --- a/refstack-ui/app/components/guidelines/guidelinesController.js +++ b/refstack-ui/app/components/guidelines/guidelinesController.js @@ -189,6 +189,9 @@ * the selected status(es). */ function getTestList() { + if (!ctrl.guidelines) { + return; + } var caps = ctrl.guidelines.capabilities; var tests = []; angular.forEach(ctrl.targetCapabilities, @@ -226,6 +229,9 @@ return ctrl.getTestList(); }, version: function () { + if (!ctrl.version) { + return; + } return ctrl.version.slice(0, -5); }, status: function () { @@ -276,6 +282,9 @@ * tests list separated by newlines. */ function getTestListString() { + if (!ctrl.tests) { + return; + } return ctrl.tests.sort().join('\n'); }