fix potential crash

This commit is contained in:
ouwou 2021-03-27 02:46:37 -04:00
parent ac31bc6b94
commit fc04b376c4

View File

@ -1171,8 +1171,9 @@ void DiscordClient::HandleGatewayChannelCreate(const GatewayMessage &msg) {
m_store.BeginTransaction();
m_store.SetChannel(data.ID, data);
m_guild_to_channels[*data.GuildID].insert(data.ID);
for (const auto &p : *data.PermissionOverwrites)
m_store.SetPermissionOverwrite(data.ID, p.ID, p);
if (data.PermissionOverwrites.has_value())
for (const auto &p : *data.PermissionOverwrites)
m_store.SetPermissionOverwrite(data.ID, p.ID, p);
m_store.EndTransaction();
m_signal_channel_create.emit(data.ID);
}