Merge pull request #13534 from huffman/fix/ess-avatar-entities

Fix crash when editing avatar entities with no myAvatar
This commit is contained in:
John Conklin II 2018-07-25 14:21:12 -07:00 committed by GitHub
commit 21d043d179
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,9 +84,15 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type,
EntityTreePointer entityTree,
EntityItemID entityItemID,
const EntityItemProperties& properties) {
if (properties.getClientOnly() && properties.getOwningAvatarID() == _myAvatar->getID()) {
// this is an avatar-based entity --> update our avatar-data rather than sending to the entity-server
queueEditAvatarEntityMessage(type, entityTree, entityItemID, properties);
if (properties.getClientOnly()) {
if (!_myAvatar) {
qCWarning(entities) << "Suppressing entity edit message: cannot send clientOnly edit with no myAvatar";
} else if (properties.getOwningAvatarID() == _myAvatar->getID()) {
// this is an avatar-based entity --> update our avatar-data rather than sending to the entity-server
queueEditAvatarEntityMessage(type, entityTree, entityItemID, properties);
} else {
qCWarning(entities) << "Suppressing entity edit message: cannot send clientOnly edit for another avatar";
}
return;
}