Merge pull request #13708 from sethalves/fix-grab-entity-w-child-overlay-crash

fix a crash when grabbing a non-dynamic entity with an overlay child
This commit is contained in:
John Conklin II 2018-07-27 12:49:14 -07:00 committed by GitHub
commit 021e09d083
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -726,16 +726,18 @@ void MyAvatar::simulate(float deltaTime) {
properties.setQueryAACubeDirty();
properties.setLastEdited(now);
packetSender->queueEditEntityMessage(PacketType::EntityEdit, entityTree, entity->getID(), properties);
packetSender->queueEditEntityMessage(PacketType::EntityEdit, entityTree,
entity->getID(), properties);
entity->setLastBroadcast(usecTimestampNow());
entity->forEachDescendant([&](SpatiallyNestablePointer descendant) {
EntityItemPointer entityDescendant = std::static_pointer_cast<EntityItem>(descendant);
if (!entityDescendant->getClientOnly() && descendant->updateQueryAACube()) {
EntityItemPointer entityDescendant = std::dynamic_pointer_cast<EntityItem>(descendant);
if (entityDescendant && !entityDescendant->getClientOnly() && descendant->updateQueryAACube()) {
EntityItemProperties descendantProperties;
descendantProperties.setQueryAACube(descendant->getQueryAACube());
descendantProperties.setLastEdited(now);
packetSender->queueEditEntityMessage(PacketType::EntityEdit, entityTree, entityDescendant->getID(), descendantProperties);
packetSender->queueEditEntityMessage(PacketType::EntityEdit, entityTree,
entityDescendant->getID(), descendantProperties);
entityDescendant->setLastBroadcast(now); // for debug/physics status icons
}
});