From 8b311c706c0b0aa8c8b105cb7597f638094117d3 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Tue, 13 Mar 2018 11:58:47 +0000 Subject: [PATCH] Null guard widget listener --- src/components/views/elements/AppTile.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/views/elements/AppTile.js b/src/components/views/elements/AppTile.js index b29b2ae8a2..bedc9b09b9 100644 --- a/src/components/views/elements/AppTile.js +++ b/src/components/views/elements/AppTile.js @@ -170,8 +170,10 @@ export default class AppTile extends React.Component { // Widget postMessage listeners try { - this.widgetMessaging.stopListening(); - this.widgetMessaging.removeEndpoint(this.props.id, this.props.url); + if (this.widgetMessaging) { + this.widgetMessaging.stopListening(); + this.widgetMessaging.removeEndpoint(this.props.id, this.props.url); + } } catch (e) { console.error('Failed to stop listening for widgetMessaging events', e.message); }