Don't allow reactions ref count got bellow 0

This commit is contained in:
luiscuenca 2019-08-23 08:46:59 -07:00
parent 4d71891763
commit da9163616a
No known key found for this signature in database
GPG key ID: 2387ECD129A6961D

View file

@ -5863,7 +5863,11 @@ bool MyAvatar::endReaction(QString reactionName) {
int reactionIndex = beginEndReactionNameToIndex(reactionName);
if (reactionIndex >= 0 && reactionIndex < (int)NUM_AVATAR_BEGIN_END_REACTIONS) {
std::lock_guard<std::mutex> guard(_reactionLock);
_reactionEnabledRefCounts[reactionIndex]--;
if (_reactionEnabledRefCounts[reactionIndex] > 0) {
_reactionEnabledRefCounts[reactionIndex]--;
} else {
_reactionEnabledRefCounts[reactionIndex] = 0;
}
return true;
}
return false;