Don't cause undefined behavior by calling std::vector<>::front() for empty container.

This commit is contained in:
Aleric Inglewood
2013-12-24 19:33:17 +01:00
parent a17eca6300
commit 1f80dac4c0

View File

@@ -135,7 +135,15 @@ void LLInitialWearablesFetch::processContents()
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t wearable_array;
LLFindWearables is_wearable;
llassert(mComplete.size() != 0);
// <singu temporary fix>
llassert(!mComplete.empty());
if (mComplete.empty())
{
// We can't call mComplete.front() in this case.
llwarns << "mComplete is empty." << llendl;
}
else
// </singu temporary fix>
gInventory.collectDescendentsIf(mComplete.front(), cat_array, wearable_array,
LLInventoryModel::EXCLUDE_TRASH, is_wearable);