summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-10-29 12:02:40 -0700
committerMerov Linden <merov@lindenlab.com>2013-10-29 12:02:40 -0700
commit542864f8ea9bb5602ac76553d76898178ad79d0f (patch)
tree67482c14f956fc3dc65e200701aad252bff85e46
parent85b6aeb4046c08986310eeb74d3cc1806dd07719 (diff)
ACME-1099 : Prevent possible crashes on get connect URL for Twitter and Flickr
-rw-r--r--indra/newview/llfacebookconnect.cpp48
1 files changed, 36 insertions, 12 deletions
diff --git a/indra/newview/llfacebookconnect.cpp b/indra/newview/llfacebookconnect.cpp
index 67a1792aa5..f82c5a05a0 100644
--- a/indra/newview/llfacebookconnect.cpp
+++ b/indra/newview/llfacebookconnect.cpp
@@ -373,25 +373,35 @@ std::string LLFacebookConnect::getFacebookConnectURL(const std::string& route, b
std::string LLFacebookConnect::getFlickrConnectURL(const std::string& route, bool include_read_from_master)
{
- std::string url = gAgent.getRegion()->getCapability("FlickrConnect");
- url += route;
+ std::string url("");
+ LLViewerRegion *regionp = gAgent.getRegion();
+ if (regionp)
+ {
+ url = regionp->getCapability("FlickrConnect");
+ url += route;
- if (include_read_from_master && mReadFromMaster)
- {
- url += "?read_from_master=true";
- }
+ if (include_read_from_master && mReadFromMaster)
+ {
+ url += "?read_from_master=true";
+ }
+ }
return url;
}
std::string LLFacebookConnect::getTwitterConnectURL(const std::string& route, bool include_read_from_master)
{
- std::string url = gAgent.getRegion()->getCapability("TwitterConnect");
- url += route;
+ std::string url("");
+ LLViewerRegion *regionp = gAgent.getRegion();
+ if (regionp)
+ {
+ url = regionp->getCapability("TwitterConnect");
+ url += route;
- if (include_read_from_master && mReadFromMaster)
- {
- url += "?read_from_master=true";
- }
+ if (include_read_from_master && mReadFromMaster)
+ {
+ url += "?read_from_master=true";
+ }
+ }
return url;
}
@@ -399,9 +409,13 @@ void LLFacebookConnect::connectToFacebook(const std::string& auth_code, const st
{
LLSD body;
if (!auth_code.empty())
+ {
body["code"] = auth_code;
+ }
if (!auth_state.empty())
+ {
body["state"] = auth_state;
+ }
LLHTTPClient::put(getFacebookConnectURL("/connection"), body, new LLFacebookConnectResponder());
}
@@ -450,15 +464,25 @@ void LLFacebookConnect::postCheckin(const std::string& location, const std::stri
{
LLSD body;
if (!location.empty())
+ {
body["location"] = location;
+ }
if (!name.empty())
+ {
body["name"] = name;
+ }
if (!description.empty())
+ {
body["description"] = description;
+ }
if (!image.empty())
+ {
body["image"] = image;
+ }
if (!message.empty())
+ {
body["message"] = message;
+ }
// Note: we can use that route for different publish action. We should be able to use the same responder.
LLHTTPClient::post(getFacebookConnectURL("/share/checkin", true), body, new LLFacebookShareResponder());