Fix crashes when logging out of connection
This commit is contained in:
@@ -221,6 +221,10 @@ int RoomTreeModel::rowCount(const QModelIndex &parent) const
|
|||||||
parentItem = static_cast<RoomTreeItem *>(parent.internalPointer());
|
parentItem = static_cast<RoomTreeItem *>(parent.internalPointer());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!parentItem) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
return parentItem->childCount();
|
return parentItem->childCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -244,7 +244,9 @@ void RoomManager::loadInitialRoom()
|
|||||||
void RoomManager::openRoomForActiveConnection()
|
void RoomManager::openRoomForActiveConnection()
|
||||||
{
|
{
|
||||||
if (!m_connection) {
|
if (!m_connection) {
|
||||||
m_currentRoom = nullptr;
|
setCurrentRoom({});
|
||||||
|
setCurrentSpace({}, false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
const auto &lastRoom = m_lastRoomConfig.readEntry(m_connection->userId(), QString());
|
const auto &lastRoom = m_lastRoomConfig.readEntry(m_connection->userId(), QString());
|
||||||
if (lastRoom.isEmpty() || !m_connection->room(lastRoom)) {
|
if (lastRoom.isEmpty() || !m_connection->room(lastRoom)) {
|
||||||
@@ -426,7 +428,9 @@ void RoomManager::setCurrentSpace(const QString &spaceId, bool setRoom)
|
|||||||
m_sortFilterRoomTreeModel->setMode(m_currentSpaceId == QLatin1String("DM") ? SortFilterRoomTreeModel::DirectChats : SortFilterRoomTreeModel::Rooms);
|
m_sortFilterRoomTreeModel->setMode(m_currentSpaceId == QLatin1String("DM") ? SortFilterRoomTreeModel::DirectChats : SortFilterRoomTreeModel::Rooms);
|
||||||
|
|
||||||
Q_EMIT currentSpaceChanged();
|
Q_EMIT currentSpaceChanged();
|
||||||
m_lastSpaceConfig.writeEntry(m_connection->userId(), spaceId);
|
if (m_connection) {
|
||||||
|
m_lastSpaceConfig.writeEntry(m_connection->userId(), spaceId);
|
||||||
|
}
|
||||||
|
|
||||||
if (!setRoom) {
|
if (!setRoom) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user