Merge pull request #12734 from samcake/RC66-fetchMetaItem

RC66: Add an extra sanity check when calling fetchMetaSubItemBounds
This commit is contained in:
John Conklin II 2018-03-29 11:05:08 -07:00 committed by GitHub
commit a76b4b1008
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -118,9 +118,15 @@ uint32_t Item::fetchMetaSubItemBounds(ItemBounds& subItemBounds, Scene& scene) c
auto numSubs = fetchMetaSubItems(subItems);
for (auto id : subItems) {
auto& item = scene.getItem(id);
if (item.exist()) {
subItemBounds.emplace_back(id, item.getBound());
// TODO: Adding an extra check here even thought we shouldn't have too.
// We have cases when the id returned by fetchMetaSubItems is not allocated
if (scene.isAllocatedID(id)) {
auto& item = scene.getItem(id);
if (item.exist()) {
subItemBounds.emplace_back(id, item.getBound());
} else {
numSubs--;
}
} else {
numSubs--;
}