diff options
author | ElzorFox <elzorfox@ya.ru> | 2017-02-17 07:48:49 +0500 |
---|---|---|
committer | ElzorFox <elzorfox@ya.ru> | 2017-02-17 07:48:49 +0500 |
commit | a73b940fda6f92db9543039b6219ed9f80db3c4e (patch) | |
tree | cca0b0e0e81c8aa89fe5056d6428e4251cc76ef9 /protocols/VKontakte | |
parent | b077e485892bf186cae0084aa4d45e468c530378 (diff) |
VKontakte: fix potential crash
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r-- | protocols/VKontakte/src/misc.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 65efe4b980..789d5659d4 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -271,10 +271,14 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode) if (!jnError || !jnErrorCode)
return true;
+
+ int iErrorCode = jnErrorCode.as_int();
+ debugLogA("CVkProto::CheckJsonResult %d", iErrorCode);
+ if (!pReq)
+ return (iErrorCode == 0);
- pReq->m_iErrorCode = jnErrorCode.as_int();
- debugLogA("CVkProto::CheckJsonResult %d", pReq->m_iErrorCode);
- switch (pReq->m_iErrorCode) {
+ pReq->m_iErrorCode = iErrorCode;
+ switch (iErrorCode) {
case VKERR_AUTHORIZATION_FAILED:
ConnectionFailed(LOGINERR_WRONGPASSWORD);
break;
@@ -318,7 +322,7 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode) pReq->m_iRetry--;
}
else {
- CMStringW msg(FORMAT, TranslateT("Error %d. Data will not be sent or received."), pReq->m_iErrorCode);
+ CMStringW msg(FORMAT, TranslateT("Error %d. Data will not be sent or received."), iErrorCode);
MsgPopup(NULL, msg, TranslateT("Error"), true);
debugLogA("CVkProto::CheckJsonResult SendError");
}
@@ -345,7 +349,7 @@ bool CVkProto::CheckJsonResult(AsyncHttpRequest *pReq, const JSONNode &jnNode) break;
}
- return pReq->m_iErrorCode == 0;
+ return (iErrorCode == 0);
}
void CVkProto::OnReceiveSmth(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
|