From 3eb1080129c891164ad2f6d16a8b0ea13649fe4e Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Thu, 10 Nov 2022 22:52:35 +0100 Subject: [PATCH] Don't crash when creating a DM --- src/controller.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/controller.cpp b/src/controller.cpp index 3e2ff7fe7..d77ea32f9 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -720,8 +720,11 @@ void Controller::openOrCreateDirectChat(NeoChatUser *user) const auto existing = activeConnection()->directChats(); if (existing.contains(user)) { - RoomManager::instance().enterRoom(static_cast(activeConnection()->room(existing.value(user)))); - return; + const auto &room = static_cast(activeConnection()->room(existing.value(user))); + if (room) { + RoomManager::instance().enterRoom(room); + return; + } } activeConnection()->requestDirectChat(user); }