From 8b62b59b2e8b15fcff265b70352d791d32ca0fd6 Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Mon, 30 Apr 2018 12:13:55 +1000
Subject: [PATCH] FIX: in some cases we subscribed to an invalid channel

in some very rare cases we would publish and empty payload causing
messagebus corruption

this broke all navigation
---
 .../discourse/components/composer-presence-display.js.es6      | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6 b/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6
index 460de128e49..296736f3c3f 100644
--- a/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6
+++ b/plugins/discourse-presence/assets/javascripts/discourse/components/composer-presence-display.js.es6
@@ -80,6 +80,9 @@ export default Ember.Component.extend({
       if (this.get('isDestroyed')) { return; }
       this.set('presenceUsers', r.users);
       this.set('channel', r.messagebus_channel);
+
+      if (!r.messagebus_channel) { return; }
+
       this.messageBus.subscribe(r.messagebus_channel, message => {
         if (!this.get('isDestroyed')) this.set('presenceUsers', message.users);
         this._clearTimer = Ember.run.debounce(this, 'clear', keepAliveDuration + bufferTime);