From 20b6b7d37e2ae126c9e133604634d657a026283a Mon Sep 17 00:00:00 2001 From: Nicolai Tellefsen Date: Tue, 22 Mar 2016 13:46:48 +0100 Subject: NMS: Fix some infoBox content checks --- web/nms.gathering.org/js/nms-info-box.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'web/nms.gathering.org/js') diff --git a/web/nms.gathering.org/js/nms-info-box.js b/web/nms.gathering.org/js/nms-info-box.js index b360beb..1a457b7 100644 --- a/web/nms.gathering.org/js/nms-info-box.js +++ b/web/nms.gathering.org/js/nms-info-box.js @@ -164,7 +164,11 @@ nmsInfoBox._windowTypes.switchInfo = { this.sw = sw; } this.swi = nmsData.switches["switches"][this.sw]; - this.swm = nmsData.smanagement.switches[this.sw]; + try { + this.swm = nmsData.smanagement.switches[this.sw]; + } catch(e) { + this.swm = []; + } var content = []; @@ -200,7 +204,7 @@ nmsInfoBox._windowTypes.switchInfo = { showComments: function() { var domObj = document.createElement("div"); var comments = []; - if (nmsData.comments.comments != undefined && nmsData.comments.comments[this.sw] != undefined) { + if(!(!nmsData.comments || !nmsData.comments.comments || !nmsData.comments.comments[this.sw])) { for (var c in nmsData.comments.comments[this.sw]["comments"]) { var comment = nmsData.comments.comments[this.sw]["comments"][c]; if (comment["state"] == "active" || comment["state"] == "persist" || comment["state"] == "inactive") { -- cgit v1.2.3