Merge pull request #16091 from luiscuenca/reactionsRefCountFix

BUGZ-1265: Don't allow reactions refcount go bellow 0
This commit is contained in:
Shannon Romano 2019-08-23 10:57:56 -07:00 committed by GitHub
commit af46a180ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5863,8 +5863,13 @@ 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]--;
return true;
if (_reactionEnabledRefCounts[reactionIndex] > 0) {
_reactionEnabledRefCounts[reactionIndex]--;
return true;
} else {
_reactionEnabledRefCounts[reactionIndex] = 0;
return false;
}
}
return false;
}