diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-09-17 19:00:11 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-09-17 19:00:11 +0000 |
commit | 73eedf8e1ef66a2b8d4d50483eea50fa6e3160b0 (patch) | |
tree | 963dc585286c9e47be070fa222bfe6ed3cad26c9 /protocols/Tox/src/tox_network.cpp | |
parent | 26f8fb4e20c14e47284ba27effb0c5ba8455e6e5 (diff) |
Tox:
- crash fix (fixes #1031)
git-svn-id: http://svn.miranda-ng.org/main/trunk@15372 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_network.cpp')
-rw-r--r-- | protocols/Tox/src/tox_network.cpp | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/protocols/Tox/src/tox_network.cpp b/protocols/Tox/src/tox_network.cpp index e87981ef40..3e1b440595 100644 --- a/protocols/Tox/src/tox_network.cpp +++ b/protocols/Tox/src/tox_network.cpp @@ -86,23 +86,26 @@ void CToxProto::BootstrapNodes() void CToxProto::TryConnect()
{
- if (tox_self_get_connection_status(toxThread->tox) != TOX_CONNECTION_NONE)
+ if (toxThread != NULL)
{
- toxThread->isConnected = true;
- logger->Log(__FUNCTION__": successfuly connected to DHT");
+ if (tox_self_get_connection_status(toxThread->tox) != TOX_CONNECTION_NONE)
+ {
+ toxThread->isConnected = true;
+ logger->Log(__FUNCTION__": successfuly connected to DHT");
- ForkThread(&CToxProto::LoadFriendList, NULL);
+ ForkThread(&CToxProto::LoadFriendList, NULL);
- m_iStatus = m_iDesiredStatus;
- ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus);
- tox_self_set_status(toxThread->tox, MirandaToToxStatus(m_iStatus));
- logger->Log(__FUNCTION__": changing status from %i to %i", ID_STATUS_CONNECTING, m_iDesiredStatus);
- }
- else if (m_iStatus++ > TOX_MAX_CONNECT_RETRIES)
- {
- SetStatus(ID_STATUS_OFFLINE);
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
- logger->Log(__FUNCTION__": failed to connect to DHT");
+ m_iStatus = m_iDesiredStatus;
+ ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_CONNECTING, m_iStatus);
+ tox_self_set_status(toxThread->tox, MirandaToToxStatus(m_iStatus));
+ logger->Log(__FUNCTION__": changing status from %i to %i", ID_STATUS_CONNECTING, m_iDesiredStatus);
+ }
+ else if (m_iStatus++ > TOX_MAX_CONNECT_RETRIES)
+ {
+ SetStatus(ID_STATUS_OFFLINE);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
+ logger->Log(__FUNCTION__": failed to connect to DHT");
+ }
}
}
|