summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-11-22 12:47:44 +0000
committerRobert Pösel <robyer@seznam.cz>2014-11-22 12:47:44 +0000
commit3a9e5bf2542f40686e9df0adac735bf6932ff8fb (patch)
tree07e6f018eea44ce76b3a1990ca079e57dfe71ea9 /protocols
parent9efdb330fc3d60d4edf0da4579e63a4ed3a94c98 (diff)
Steam: Fix crashes on login and on other occasions
git-svn-id: http://svn.miranda-ng.org/main/trunk@11035 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Steam/src/steam_account.cpp18
-rw-r--r--protocols/Steam/src/steam_contacts.cpp9
2 files changed, 27 insertions, 0 deletions
diff --git a/protocols/Steam/src/steam_account.cpp b/protocols/Steam/src/steam_account.cpp
index 274ae4699f..7bf2645fe9 100644
--- a/protocols/Steam/src/steam_account.cpp
+++ b/protocols/Steam/src/steam_account.cpp
@@ -16,6 +16,9 @@ bool CSteamProto::IsMe(const char *steamId)
void CSteamProto::OnGotRsaKey(const NETLIBHTTPREQUEST *response, void *arg)
{
+ if (response == NULL)
+ return;
+
// load rsa key parts
JSONNODE *root = json_parse(response->pData), *node;
if (!root) return;
@@ -69,6 +72,11 @@ void CSteamProto::OnGotRsaKey(const NETLIBHTTPREQUEST *response, void *arg)
void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg)
{
+ if (response == NULL) {
+ SetStatus(ID_STATUS_OFFLINE);
+ return;
+ }
+
JSONNODE *root = json_parse(response->pData), *node;
node = json_get(root, "success");
@@ -195,6 +203,9 @@ void CSteamProto::OnAuthorization(const NETLIBHTTPREQUEST *response, void *arg)
void CSteamProto::OnGotSession(const NETLIBHTTPREQUEST *response, void *arg)
{
+ if (response == NULL)
+ return;
+
for (int i = 0; i < response->headersCount; i++)
{
if (lstrcmpiA(response->headers[i].szName, "Set-Cookie"))
@@ -211,6 +222,13 @@ void CSteamProto::OnGotSession(const NETLIBHTTPREQUEST *response, void *arg)
void CSteamProto::OnLoggedOn(const NETLIBHTTPREQUEST *response, void *arg)
{
+ if (response == NULL) {
+ // set status to offline
+ m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, ID_STATUS_OFFLINE);
+ return;
+ }
+
JSONNODE *root = json_parse(response->pData), *node;
node = json_get(root, "error");
diff --git a/protocols/Steam/src/steam_contacts.cpp b/protocols/Steam/src/steam_contacts.cpp
index 0d8cfb5472..630241dcd7 100644
--- a/protocols/Steam/src/steam_contacts.cpp
+++ b/protocols/Steam/src/steam_contacts.cpp
@@ -182,6 +182,9 @@ MCONTACT CSteamProto::AddContact(const char *steamId, bool isTemporary)
void CSteamProto::OnGotFriendList(const NETLIBHTTPREQUEST *response, void *arg)
{
+ if (response == NULL)
+ return;
+
JSONNODE *root = json_parse(response->pData), *node, *child;
if (root == NULL)
@@ -246,6 +249,9 @@ void CSteamProto::OnGotFriendList(const NETLIBHTTPREQUEST *response, void *arg)
void CSteamProto::OnGotBlockList(const NETLIBHTTPREQUEST *response, void *arg)
{
+ if (response == NULL)
+ return;
+
JSONNODE *root = json_parse(response->pData), *node, *child;
if (root == NULL)
@@ -287,6 +293,9 @@ void CSteamProto::OnGotBlockList(const NETLIBHTTPREQUEST *response, void *arg)
void CSteamProto::OnGotUserSummaries(const NETLIBHTTPREQUEST *response, void *arg)
{
+ if (response == NULL)
+ return;
+
JSONNODE *root = json_parse(response->pData), *node, *item;
node = json_get(root, "players");