From af0bfb388a4ecd2a2c67ae18743c9c63ca3fd29e Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 13:33:26 +0000 Subject: CID-132 Checker: NULL_RETURNS Function: LLPanelLandmarkInfo::getFullFolderName(const LLViewerInventoryCategory *) File: /indra/newview/llpanellandmarkinfo.cpp --- indra/newview/llpanellandmarkinfo.cpp | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp index cd6c727b5c..56d52ccc65 100644 --- a/indra/newview/llpanellandmarkinfo.cpp +++ b/indra/newview/llpanellandmarkinfo.cpp @@ -376,21 +376,31 @@ void LLPanelLandmarkInfo::createLandmark(const LLUUID& folder_id) // static std::string LLPanelLandmarkInfo::getFullFolderName(const LLViewerInventoryCategory* cat) { - std::string name = cat->getName(); + std::string name; LLUUID parent_id; - // translate category name, if it's right below the root - // FIXME: it can throw notification about non existent string in strings.xml - if (cat->getParentUUID().notNull() && cat->getParentUUID() == gInventory.getRootFolderID()) + llassert(cat); + if (cat) { - LLTrans::findString(name, "InvFolder " + name); - } + name = cat->getName(); - // we don't want "My Inventory" to appear in the name - while ((parent_id = cat->getParentUUID()).notNull() && parent_id != gInventory.getRootFolderID()) - { - cat = gInventory.getCategory(parent_id); - name = cat->getName() + "/" + name; + // translate category name, if it's right below the root + // FIXME: it can throw notification about non existent string in strings.xml + if (cat->getParentUUID().notNull() && cat->getParentUUID() == gInventory.getRootFolderID()) + { + LLTrans::findString(name, "InvFolder " + name); + } + + // we don't want "My Inventory" to appear in the name + while ((parent_id = cat->getParentUUID()).notNull() && parent_id != gInventory.getRootFolderID()) + { + cat = gInventory.getCategory(parent_id); + llassert(cat); + if (cat) + { + name = cat->getName() + "/" + name; + } + } } return name; -- cgit v1.2.3 From 86056788ec8a5af023c6b8d7d0809597bc1012f0 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 13:35:53 +0000 Subject: CID-134 Checker: NULL_RETURNS Function: LLToolsEnableUnlink::handleEvent(const LLSD &) File: /indra/newview/llviewermenu.cpp --- indra/newview/llviewermenu.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index b15a9a9e99..8c61ba7558 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -4842,9 +4842,10 @@ class LLToolsEnableUnlink : public view_listener_t { bool handleEvent(const LLSD& userdata) { + LLViewerObject* first_editable_object = LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject(); bool new_value = LLSelectMgr::getInstance()->selectGetAllRootsValid() && - LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject() && - !LLSelectMgr::getInstance()->getSelection()->getFirstEditableObject()->isAttachment(); + first_editable_object && + !first_editable_object->isAttachment(); return new_value; } }; -- cgit v1.2.3 From eb140739dbc26a0331b16b12081f1dae3847c9bb Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 13:37:08 +0000 Subject: CID-138 Checker: NULL_RETURNS Function: LLPanelFace::sendGlow() File: /indra/newview/llpanelface.cpp --- indra/newview/llpanelface.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 8c5208678e..4f450ce0a8 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -265,10 +265,13 @@ void LLPanelFace::sendAlpha() void LLPanelFace::sendGlow() { - LLSpinCtrl* mCtrlGlow = getChild("glow"); - F32 glow = mCtrlGlow->get(); - - LLSelectMgr::getInstance()->selectionSetGlow( glow ); + LLSpinCtrl* mCtrlGlow = getChild("glow"); + llassert(mCtrlGlow); + if (mCtrlGlow) + { + F32 glow = mCtrlGlow->get(); + LLSelectMgr::getInstance()->selectionSetGlow( glow ); + } } struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor -- cgit v1.2.3 From 10c9f17301e2dbacb0105b29d7214e67d5de8e85 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 13:40:45 +0000 Subject: CID-139 Checker: NULL_RETURNS Function: LLPanelFaceSetTEFunctor::apply(LLViewerObject *, int) File: /indra/newview/llpanelface.cpp --- indra/newview/llpanelface.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelface.cpp b/indra/newview/llpanelface.cpp index 4f450ce0a8..b50c6442e1 100644 --- a/indra/newview/llpanelface.cpp +++ b/indra/newview/llpanelface.cpp @@ -289,6 +289,9 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor LLCheckBoxCtrl* checkFlipScaleS = mPanel->getChild("checkbox flip s"); LLCheckBoxCtrl* checkFlipScaleT = mPanel->getChild("checkbox flip t"); LLComboBox* comboTexGen = mPanel->getChild("combobox texgen"); + llassert(comboTexGen); + llassert(object); + if (ctrlTexScaleS) { valid = !ctrlTexScaleS->getTentative() || !checkFlipScaleS->getTentative(); @@ -299,7 +302,8 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor { value = -value; } - if (comboTexGen->getCurrentIndex() == 1) + if (comboTexGen && + comboTexGen->getCurrentIndex() == 1) { value *= 0.5f; } @@ -317,7 +321,8 @@ struct LLPanelFaceSetTEFunctor : public LLSelectedTEFunctor { value = -value; } - if (comboTexGen->getCurrentIndex() == 1) + if (comboTexGen && + comboTexGen->getCurrentIndex() == 1) { value *= 0.5f; } -- cgit v1.2.3 From 0cf46fe136d23781e71e092eaed89163647c98a3 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 13:43:33 +0000 Subject: CID-144 Checker: NULL_RETURNS Function: LLInvFVBridgeAction::doAction(const LLUUID &, LLInventoryModel *) File: /indra/newview/llinventorybridge.cpp --- indra/newview/llinventorybridge.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 019a4b22c3..ec2be0e8e9 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -5096,12 +5096,18 @@ void LLInvFVBridgeAction::doAction(LLAssetType::EType asset_type, //static void LLInvFVBridgeAction::doAction(const LLUUID& uuid, LLInventoryModel* model) { - LLAssetType::EType asset_type = model->getItem(uuid)->getType(); - LLInvFVBridgeAction* action = createAction(asset_type,uuid,model); - if(action) + llassert(model); + LLViewerInventoryItem* item = model->getItem(uuid); + llassert(item); + if (item) { - action->doIt(); - delete action; + LLAssetType::EType asset_type = item->getType(); + LLInvFVBridgeAction* action = createAction(asset_type,uuid,model); + if(action) + { + action->doIt(); + delete action; + } } } -- cgit v1.2.3 From 51e2ee7b3a9d8a4a10373edd1ee99e7ee25e8a38 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 13:45:28 +0000 Subject: CID-145 Checker: NULL_RETURNS File: /indra/llui/llscrolllistctrl.cpp --- indra/newview/llfloatertopobjects.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index c930e99bad..8ab050beaa 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -283,8 +283,13 @@ void LLFloaterTopObjects::updateSelectionInfo() std::string object_id_string = object_id.asString(); childSetValue("id_editor", LLSD(object_id_string)); - childSetValue("object_name_editor", list->getFirstSelected()->getColumn(1)->getValue().asString()); - childSetValue("owner_name_editor", list->getFirstSelected()->getColumn(2)->getValue().asString()); + LLScrollListItem* sli = list->getFirstSelected(); + llassert(sli); + if (sli) + { + childSetValue("object_name_editor", sli->getColumn(1)->getValue().asString()); + childSetValue("owner_name_editor", sli->getColumn(2)->getValue().asString()); + } } // static -- cgit v1.2.3 From 710687ce6751dab6afec76b2bc2a4d03568e44ec Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 13:49:08 +0000 Subject: CID-208 Checker: REVERSE_INULL Function: LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup *) File: /indra/newview/llvovolume.cpp --- indra/newview/llvovolume.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 12728a2377..9fbcd1d32a 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -3494,7 +3494,8 @@ static LLFastTimer::DeclareTimer FTM_VOLUME_GEOM("Volume Geometry"); void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) { llpushcallstacks ; - if (group->isState(LLSpatialGroup::MESH_DIRTY) && !group->isState(LLSpatialGroup::GEOM_DIRTY)) + llassert(group); + if (group && group->isState(LLSpatialGroup::MESH_DIRTY) && !group->isState(LLSpatialGroup::GEOM_DIRTY)) { LLFastTimer tm(FTM_VOLUME_GEOM); S32 num_mapped_veretx_buffer = LLVertexBuffer::sMappedCount ; @@ -3548,9 +3549,9 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) } // don't forget alpha - if( group != NULL && - !group->mVertexBuffer.isNull() && - group->mVertexBuffer->isLocked()) + if(group != NULL && + !group->mVertexBuffer.isNull() && + group->mVertexBuffer->isLocked()) { group->mVertexBuffer->setBuffer(0); } @@ -3576,7 +3577,7 @@ void LLVolumeGeometryManager::rebuildMesh(LLSpatialGroup* group) group->clearState(LLSpatialGroup::MESH_DIRTY | LLSpatialGroup::NEW_DRAWINFO); } - if (group->isState(LLSpatialGroup::NEW_DRAWINFO)) + if (group && group->isState(LLSpatialGroup::NEW_DRAWINFO)) { llerrs << "WTF?" << llendl; } -- cgit v1.2.3 From 3ac37e9b896e19b6c7ba24aa038d49551c5add38 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 14:00:30 +0000 Subject: CID-211 Checker: REVERSE_INULL Function: LLChicletPanel::findChiclet(const LLUUID &) File: /indra/newview/llchiclet.h --- indra/newview/llchiclet.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index b006ae3420..ba17c5970e 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -1228,12 +1228,15 @@ T* LLChicletPanel::findChiclet(const LLUUID& im_session_id) { LLChiclet* chiclet = *it; + llassert(chiclet); + if (!chiclet) continue; if(chiclet->getSessionId() == im_session_id) { T* result = dynamic_cast(chiclet); - if(!result && chiclet) + if(!result) { llwarns << "Found chiclet but of wrong type " << llendl; + continue; } return result; } -- cgit v1.2.3 From 74ffa0fa480e57371acd992fce7f291f04456729 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 14:04:26 +0000 Subject: CID-207 Checker: REVERSE_INULL Function: LLInventoryModel::addItem(LLViewerInventoryItem *) File: /indra/newview/llinventorymodel.cpp --- indra/newview/llinventorymodel.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index 7ec976604a..a6e8f07e21 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1937,23 +1937,25 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) { //llinfos << "LLInventoryModel::addItem()" << llendl; - // This can happen if assettype enums from llassettype.h ever change. - // For example, there is a known backwards compatibility issue in some viewer prototypes prior to when - // the AT_LINK enum changed from 23 to 24. - if ((item->getType() == LLAssetType::AT_NONE) - || LLAssetType::lookup(item->getType()) == LLAssetType::badLookup()) - { - llwarns << "Got bad asset type for item [ name: " << item->getName() << " type: " << item->getType() << " inv-type: " << item->getInventoryType() << " ], ignoring." << llendl; - return; - } if(item) { + // This can happen if assettype enums from llassettype.h ever change. + // For example, there is a known backwards compatibility issue in some viewer prototypes prior to when + // the AT_LINK enum changed from 23 to 24. + if ((item->getType() == LLAssetType::AT_NONE) + || LLAssetType::lookup(item->getType()) == LLAssetType::badLookup()) + { + llwarns << "Got bad asset type for item [ name: " << item->getName() << " type: " << item->getType() << " inv-type: " << item->getInventoryType() << " ], ignoring." << llendl; + return; + } + // This condition means that we tried to add a link without the baseobj being in memory. // The item will show up as a broken link. if (item->getIsBrokenLink()) { llinfos << "Adding broken link [ name: " << item->getName() << " itemID: " << item->getUUID() << " assetID: " << item->getAssetUUID() << " ) parent: " << item->getParentUUID() << llendl; } + mItemMap[item->getUUID()] = item; } } -- cgit v1.2.3 From a0c57cbb824f5ec976f43a096c320929c7d89120 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Sat, 13 Feb 2010 14:05:09 +0000 Subject: CID-207 assert. --- indra/newview/llinventorymodel.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'indra/newview') diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp index a6e8f07e21..326f2a5577 100644 --- a/indra/newview/llinventorymodel.cpp +++ b/indra/newview/llinventorymodel.cpp @@ -1937,6 +1937,7 @@ void LLInventoryModel::addItem(LLViewerInventoryItem* item) { //llinfos << "LLInventoryModel::addItem()" << llendl; + llassert(item); if(item) { // This can happen if assettype enums from llassettype.h ever change. -- cgit v1.2.3