summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryobserver.cpp
diff options
context:
space:
mode:
authorYuri Chebotarev <ychebotarev@productengine.com>2010-04-26 19:07:55 +0300
committerYuri Chebotarev <ychebotarev@productengine.com>2010-04-26 19:07:55 +0300
commit6a9d277e00d9c20a8f3359627864f731923baac3 (patch)
treee3a6ee9046bca45cc42e9cd82cb4713a99d8d3da /indra/newview/llinventoryobserver.cpp
parent24894a5f71b76aab407976ff9bf36bfc0f7ae70a (diff)
parentfbfc85176670f3f948e6e2f00c8d8e37c96d5299 (diff)
merge
--HG-- branch : product-engine
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);
}