From f49bd6377eba2dc7bcfe40e31a62cd29a5bdc31b Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Wed, 7 Dec 2016 12:44:04 +0100 Subject: [PATCH] manager: safe widget removal (check for props before looking into stores) --- src/browser/js/app/managers.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/browser/js/app/managers.js b/src/browser/js/app/managers.js index c78690f3..8e16a95e 100644 --- a/src/browser/js/app/managers.js +++ b/src/browser/js/app/managers.js @@ -91,10 +91,10 @@ WidgetManager.prototype.removeWidget = function(hash) { linkId = widget.widgetData.linkId, id = widget.widgetData.id - delete this.widgets[hash] - delete this.idRoute[id][h2] - delete this.linkIdRoute[linkId][h2] - delete this.addressRoute[address][h2] + if (this.widgets[hash]) delete this.widgets[hash] + if (id && this.idRoute[id][h2]) delete this.idRoute[id][h2] + if (linkId && this.linkIdRoute[linkId][h2]) delete this.linkIdRoute[linkId][h2] + if (address && this.addressRoute[address][h2]) delete this.addressRoute[address][h2] } WidgetManager.prototype.getWidgetBy = function(key, dict) {