Skip to content
Snippets Groups Projects
Commit 3a25753b authored by Aaron Stone's avatar Aaron Stone
Browse files

STORM-1368 Code more defensively around notecard upload.

parent f0694e45
No related branches found
No related tags found
No related merge requests found
...@@ -401,15 +401,14 @@ struct LLSaveNotecardInfo ...@@ -401,15 +401,14 @@ struct LLSaveNotecardInfo
bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem)
{ {
if(!gAssetStorage) LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
if(!editor)
{ {
llwarns << "Not connected to an asset storage system." << llendl; llwarns << "Cannot get handle to the notecard editor." << llendl;
return false; return false;
} }
LLViewerTextEditor* editor = getChild<LLViewerTextEditor>("Notecard Editor");
if(!editor->isPristine()) if(!editor->isPristine())
{ {
// We need to update the asset information // We need to update the asset information
...@@ -436,8 +435,15 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) ...@@ -436,8 +435,15 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem)
// save it out to database // save it out to database
if (item) if (item)
{ {
std::string agent_url = gAgent.getRegion()->getCapability("UpdateNotecardAgentInventory"); const LLViewerRegion* region = gAgent.getRegion();
std::string task_url = gAgent.getRegion()->getCapability("UpdateNotecardTaskInventory"); 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()) if (mObjectUUID.isNull() && !agent_url.empty())
{ {
// Saving into agent inventory // Saving into agent inventory
...@@ -472,6 +478,11 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem) ...@@ -472,6 +478,11 @@ bool LLPreviewNotecard::saveIfNeeded(LLInventoryItem* copyitem)
(void*)info, (void*)info,
FALSE); FALSE);
} }
else // !gAssetStorage
{
llwarns << "Not connected to an asset storage system." << llendl;
return false;
}
} }
} }
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment