diff -r dc5af272d23f indra/newview/llpreviewnotecard.cpp --- a/indra/newview/llpreviewnotecard.cpp Wed Jun 15 12:04:09 2011 -0400 +++ b/indra/newview/llpreviewnotecard.cpp Fri Jun 17 15:57:39 2011 -0700 @@ -401,15 +401,14 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) { - if(!gAssetStorage) + LLViewerTextEditor* editor = getChild("Notecard Editor"); + + if(!editor) { - llwarns << "Not connected to an asset storage system." << llendl; + llwarns << "Cannot get handle to the notecard editor." << llendl; return false; } - - LLViewerTextEditor* editor = getChild("Notecard Editor"); - if(!editor->isPristine()) { // We need to update the asset information @@ -436,8 +435,15 @@ // save it out to database if (item) { - std::string agent_url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory"); - std::string task_url = gAgent.getRegion()->getCapability("UpdateNotecardTaskInventory"); + const LLViewerRegion* region = gAgent.getRegion(); + if (!region) + { + llwarns << "Not connected to a region, cannot save notecard." << llendl; + return false; + } + std::string agent_url = region->getCapability("UpdateNotecardAgentInventory"); + std::string task_url = region->getCapability("UpdateNotecardTaskInventory"); + if (mObjectUUID.isNull() && !agent_url.empty()) { // Saving into agent inventory @@ -472,6 +478,11 @@ (void*)info, FALSE); } + else // !gAssetStorage + { + llwarns << "Not connected to an asset storage system." << llendl; + return false; + } } } return true;