mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-29 14:18:49 +03:00
RoomList: do not blindly dereference RoomState (#232)
This can happen when a new room is being created from a different client and thus is created with no known state to the local client.
This commit is contained in:
parent
ba8faa357f
commit
0be787f1e4
1 changed files with 8 additions and 5 deletions
|
@ -198,13 +198,16 @@ RoomList::sync(const std::map<QString, QSharedPointer<RoomState>> &states,
|
||||||
if (!roomExists(state.first))
|
if (!roomExists(state.first))
|
||||||
addRoom(settings.at(state.first), state.second, state.first);
|
addRoom(settings.at(state.first), state.second, state.first);
|
||||||
|
|
||||||
auto room = rooms_[state.first];
|
auto room = rooms_[state.first];
|
||||||
|
auto room_state = room->state();
|
||||||
|
|
||||||
auto current_avatar = room->state()->getAvatar();
|
if (room_state) {
|
||||||
auto new_avatar = state.second->getAvatar();
|
auto current_avatar = room_state->getAvatar();
|
||||||
|
auto new_avatar = state.second->getAvatar();
|
||||||
|
|
||||||
if (current_avatar != new_avatar && !new_avatar.toString().isEmpty())
|
if (current_avatar != new_avatar && !new_avatar.toString().isEmpty())
|
||||||
updateAvatar(state.first, new_avatar.toString());
|
updateAvatar(state.first, new_avatar.toString());
|
||||||
|
}
|
||||||
|
|
||||||
room->setState(state.second);
|
room->setState(state.second);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue