summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryobserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventoryobserver.cpp')
-rw-r--r--indra/newview/llinventoryobserver.cpp30
1 files changed, 24 insertions, 6 deletions
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 03006243f9..214b5d317a 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -658,11 +658,13 @@ void LLInventoryCategoriesObserver::changed(U32 mask)
for (category_map_t::iterator iter = mCategoryMap.begin();
iter != mCategoryMap.end();
- iter++)
+ ++iter)
{
- // Inventory category version is used to find out if some changes
- // to a category have been made.
- S32 version = gInventory.getCategory((*iter).first)->getVersion();
+ LLViewerInventoryCategory* category = gInventory.getCategory((*iter).first);
+ if (!category)
+ continue;
+
+ S32 version = category->getVersion();
if (version != (*iter).second.mVersion)
{
// Update category version in map.
@@ -674,11 +676,27 @@ void LLInventoryCategoriesObserver::changed(U32 mask)
void LLInventoryCategoriesObserver::addCategory(const LLUUID& cat_id, callback_t cb)
{
- S32 version = gInventory.getCategory(cat_id)->getVersion();
+ S32 version;
+ LLViewerInventoryCategory* category = gInventory.getCategory(cat_id);
+ if (category)
+ {
+ // Inventory category version is used to find out if some changes
+ // to a category have been made.
+ version = category->getVersion();
+ }
+ else
+ {
+ // If category could not be retrieved it might mean that
+ // inventory is unusable at the moment so the category is
+ // stored with VERSION_UNKNOWN and it may be updated later.
+ version = LLViewerInventoryCategory::VERSION_UNKNOWN;
+ }
+
+ version = category->getVersion();
mCategoryMap.insert(category_map_value_t(cat_id, LLCategoryData(cb, version)));
}
void LLInventoryCategoriesObserver::removeCategory(const LLUUID& cat_id)
{
- mCategoryMap.erase(mCategoryMap.find(cat_id));
+ mCategoryMap.erase(cat_id);
}