Merge pull request #11087 from jherico/crash_null_entity_element

Fix potential nullptr access in EntityTreeElement
This commit is contained in:
Chris Collins 2017-07-31 09:15:52 -07:00 committed by GitHub
commit 5bdaa4daa1

View file

@ -1001,7 +1001,10 @@ int EntityTreeElement::readElementDataFromBuffer(const unsigned char* data, int
if (!bestFitBefore && bestFitAfter) {
// This is the case where the entity existed, and is in some element in our tree...
if (currentContainingElement.get() != this) {
currentContainingElement->removeEntityItem(entityItem);
// if the currentContainingElement is non-null, remove the entity from it
if (currentContainingElement) {
currentContainingElement->removeEntityItem(entityItem);
}
addEntityItem(entityItem);
}
}