From eeb5fb382bdb45c4c886a113506b777e85cbf4e2 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 21 Oct 2014 19:34:54 -0700 Subject: DD-221 : Pointer testing to avoid potential crash --- indra/newview/llmarketplacefunctions.cpp | 33 +++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'indra/newview/llmarketplacefunctions.cpp') diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp index b4a2921f8c..4bf0eac03b 100755 --- a/indra/newview/llmarketplacefunctions.cpp +++ b/indra/newview/llmarketplacefunctions.cpp @@ -1059,7 +1059,7 @@ void LLMarketplaceInventoryObserver::changed(U32 mask) // once observers are called) we need to raise a flag in the inventory to signal that things have been dirtied. // That's the only changes that really do make sense for marketplace to worry about - if ((mask & (LLInventoryObserver::INTERNAL | LLInventoryObserver::STRUCTURE)) != 0) + if (mask & (LLInventoryObserver::INTERNAL | LLInventoryObserver::STRUCTURE)) { const std::set& changed_items = gInventory.getChangedIDs(); @@ -1068,24 +1068,27 @@ void LLMarketplaceInventoryObserver::changed(U32 mask) for (;id_it != id_end; ++id_it) { LLInventoryObject* obj = gInventory.getObject(*id_it); - if (LLAssetType::AT_CATEGORY == obj->getType()) + if (obj) { - // If it's a folder known to the marketplace, let's check it's in proper shape - if (LLMarketplaceData::instance().isListed(*id_it) || LLMarketplaceData::instance().isVersionFolder(*id_it)) + if (LLAssetType::AT_CATEGORY == obj->getType()) { - LLInventoryCategory* cat = (LLInventoryCategory*)(obj); - validate_marketplacelistings(cat); + // If it's a folder known to the marketplace, let's check it's in proper shape + if (LLMarketplaceData::instance().isListed(*id_it) || LLMarketplaceData::instance().isVersionFolder(*id_it)) + { + LLInventoryCategory* cat = (LLInventoryCategory*)(obj); + validate_marketplacelistings(cat); + } } - } - else - { - // If it's not a category, it's an item... - LLInventoryItem* item = (LLInventoryItem*)(obj); - // If it's a no copy item, we may need to update the label count of marketplace listings - if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + else { - LLMarketplaceData::instance().setDirtyCount(); - } + // If it's not a category, it's an item... + LLInventoryItem* item = (LLInventoryItem*)(obj); + // If it's a no copy item, we may need to update the label count of marketplace listings + if (!item->getPermissions().allowOperationBy(PERM_COPY, gAgent.getID(), gAgent.getGroupID())) + { + LLMarketplaceData::instance().setDirtyCount(); + } + } } } } -- cgit v1.2.3