From b28d79e64433b096ead6580105521278e177e58a Mon Sep 17 00:00:00 2001
From: Diego Mello <diegolmello@gmail.com>
Date: Mon, 3 Jun 2019 09:53:06 -0300
Subject: [PATCH] [FIX] Thread crash if room is undefined (#956)

---
 app/views/ThreadMessagesView/index.js | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/app/views/ThreadMessagesView/index.js b/app/views/ThreadMessagesView/index.js
index b8d9f7acf..42e9f4a08 100644
--- a/app/views/ThreadMessagesView/index.js
+++ b/app/views/ThreadMessagesView/index.js
@@ -85,6 +85,12 @@ export default class ThreadMessagesView extends React.Component {
 	// eslint-disable-next-line react/sort-comp
 	init = () => {
 		const [room] = this.rooms;
+
+		// if there's not room at this point, it's better to show nothing
+		if (!room) {
+			return;
+		}
+
 		const lastThreadSync = new Date();
 		if (room.lastThreadSync) {
 			this.sync(room.lastThreadSync);
-- 
GitLab