1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Fix segfault, minor cleanup

This commit is contained in:
Dubslow 2015-01-23 05:48:55 -06:00
parent 29cc9e1b7d
commit dea2ccf0b7

View File

@ -224,7 +224,6 @@ void Core::start()
if (loadPath.isEmpty()) if (loadPath.isEmpty())
{ {
qCritical() << "Core: loadConfiguration failed, exiting now"; qCritical() << "Core: loadConfiguration failed, exiting now";
deadifyTox();
emit failedToStart(); emit failedToStart();
return; return;
} }
@ -302,7 +301,7 @@ void Core::start()
void Core::process() void Core::process()
{ {
if (!tox) if (!isReady())
return; return;
static int tolerance = CORE_DISCONNECT_TOLERANCE; static int tolerance = CORE_DISCONNECT_TOLERANCE;
@ -1004,7 +1003,7 @@ void Core::acceptFileRecvRequest(int friendId, int fileNum, QString path)
void Core::removeFriend(int friendId, bool fake) void Core::removeFriend(int friendId, bool fake)
{ {
if (!tox || fake) if (!isReady() || fake)
return; return;
if (tox_del_friend(tox, friendId) == -1) { if (tox_del_friend(tox, friendId) == -1) {
emit failedToRemoveFriend(friendId); emit failedToRemoveFriend(friendId);
@ -1016,7 +1015,7 @@ void Core::removeFriend(int friendId, bool fake)
void Core::removeGroup(int groupId, bool fake) void Core::removeGroup(int groupId, bool fake)
{ {
if (!tox || fake) if (!isReady() || fake)
return; return;
tox_del_groupchat(tox, groupId); tox_del_groupchat(tox, groupId);
@ -1673,7 +1672,7 @@ QString Core::getPeerName(const ToxID& id) const
bool Core::isReady() bool Core::isReady()
{ {
return ready; return toxav && tox && ready;
} }
void Core::setNospam(uint32_t nospam) void Core::setNospam(uint32_t nospam)