diff options
| author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2025-10-23 19:10:12 +0300 |
|---|---|---|
| committer | Andrey Lihatskiy <118752495+marchcat@users.noreply.github.com> | 2025-10-23 19:25:33 +0300 |
| commit | 34dcaaaacd7865e3a652159b4fb1d58dfa0cb91b (patch) | |
| tree | cf25c1be47ec5d37d1e1f50200187e688976438f /indra/newview/llinventorymodelbackgroundfetch.cpp | |
| parent | d0b7731045699c32d04169f0b5f87c347f70ae38 (diff) | |
#4887 Fix access violation in LLInventoryModelBackgroundFetch::bulkFetchViaAis
Diffstat (limited to 'indra/newview/llinventorymodelbackgroundfetch.cpp')
| -rw-r--r-- | indra/newview/llinventorymodelbackgroundfetch.cpp | 71 |
1 files changed, 40 insertions, 31 deletions
diff --git a/indra/newview/llinventorymodelbackgroundfetch.cpp b/indra/newview/llinventorymodelbackgroundfetch.cpp index 2cf1554957..d538d42972 100644 --- a/indra/newview/llinventorymodelbackgroundfetch.cpp +++ b/indra/newview/llinventorymodelbackgroundfetch.cpp @@ -886,31 +886,34 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc static LLCachedControl<S32> ais_batch(gSavedSettings, "BatchSizeAIS3", 20); S32 batch_limit = llclamp(ais_batch(), 1, 40); - for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); - it != categories->end(); - ++it) + if (categories) { - LLViewerInventoryCategory* child_cat = (*it); - if (LLViewerInventoryCategory::VERSION_UNKNOWN != child_cat->getVersion() - || child_cat->getFetching() >= target_state) + for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); + it != categories->end(); + ++it) { - continue; - } + LLViewerInventoryCategory* child_cat = (*it); + if (LLViewerInventoryCategory::VERSION_UNKNOWN != child_cat->getVersion() + || child_cat->getFetching() >= target_state) + { + continue; + } - if (child_cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS) - { - // special case, marketplace will fetch that as needed - continue; - } + if (child_cat->getPreferredType() == LLFolderType::FT_MARKETPLACE_LISTINGS) + { + // special case, marketplace will fetch that as needed + continue; + } - children.emplace_back(child_cat->getUUID()); - mExpectedFolderIds.emplace_back(child_cat->getUUID()); - child_cat->setFetching(target_state); + children.emplace_back(child_cat->getUUID()); + mExpectedFolderIds.emplace_back(child_cat->getUUID()); + child_cat->setFetching(target_state); - if (children.size() >= batch_limit) - { - content_done = false; - break; + if (children.size() >= batch_limit) + { + content_done = false; + break; + } } } @@ -940,14 +943,17 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc // This will have a bit of overlap with onAISContentCalback, // but something else might have downloaded folders, so verify // every child that is complete has it's children done as well - for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); - it != categories->end(); - ++it) + if (categories) { - LLViewerInventoryCategory* child_cat = (*it); - if (LLViewerInventoryCategory::VERSION_UNKNOWN != child_cat->getVersion()) + for (LLInventoryModel::cat_array_t::iterator it = categories->begin(); + it != categories->end(); + ++it) { - mFetchFolderQueue.emplace_back(child_cat->getUUID(), FT_RECURSIVE); + LLViewerInventoryCategory* child_cat = (*it); + if (LLViewerInventoryCategory::VERSION_UNKNOWN != child_cat->getVersion()) + { + mFetchFolderQueue.emplace_back(child_cat->getUUID(), FT_RECURSIVE); + } } } } @@ -998,12 +1004,15 @@ void LLInventoryModelBackgroundFetch::bulkFetchViaAis(const FetchQueueInfo& fetc LLInventoryModel::cat_array_t* categories(NULL); LLInventoryModel::item_array_t* items(NULL); gInventory.getDirectDescendentsOf(cat_id, categories, items); - for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); - it != categories->end(); - ++it) + if (categories) { - // not emplace_front to not cause an infinite loop - mFetchFolderQueue.emplace_back((*it)->getUUID(), FT_RECURSIVE); + for (LLInventoryModel::cat_array_t::const_iterator it = categories->begin(); + it != categories->end(); + ++it) + { + // not emplace_front to not cause an infinite loop + mFetchFolderQueue.emplace_back((*it)->getUUID(), FT_RECURSIVE); + } } } } |
