Made this more thread safty

This commit is contained in:
WolverinDEV 2019-07-18 10:45:50 +02:00
parent 2177e51380
commit 338ff1c399

View File

@ -130,15 +130,16 @@ void ConnectedClient::updateChannelClientProperties(bool lock_channel_tree, bool
} }
IconId iconId = 0; IconId iconId = 0;
if(this->clientPermissions) { auto local_permissions = this->clientPermissions;
if(local_permissions) {
permission::v2::PermissionFlaggedValue value{0, false}; permission::v2::PermissionFlaggedValue value{0, false};
auto permission_flags = this->clientPermissions->permission_flags(permission::i_icon_id); auto permission_flags = local_permissions->permission_flags(permission::i_icon_id);
if(permission_flags.channel_specific && this->currentChannel) { if(permission_flags.channel_specific && this->currentChannel) {
auto val = this->clientPermissions->channel_permission(permission::i_icon_id, this->currentChannel->channelId()); auto val = local_permissions->channel_permission(permission::i_icon_id, this->currentChannel->channelId());
value = {val.values.value, val.flags.value_set}; value = {val.values.value, val.flags.value_set};
} }
if(!value.has_value) if(!value.has_value)
value = this->clientPermissions->permission_value_flagged(permission::i_icon_id); value = local_permissions->permission_value_flagged(permission::i_icon_id);
if(value.has_value) if(value.has_value)
iconId = value.value; iconId = value.value;
} }