mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-29 04:08:54 +03:00
Return from Folder::slotPollTimerTimeout() if the account object is 0
Right now, we crash instead. This can happen if a folder is created when an account object is not (anymore/yet) created. Fixes #2142
This commit is contained in:
parent
fcbadda40f
commit
c0131695c5
1 changed files with 12 additions and 4 deletions
|
@ -255,8 +255,16 @@ void Folder::slotPollTimerTimeout()
|
||||||
{
|
{
|
||||||
qDebug() << "* Polling" << alias() << "for changes. (time since last sync:" << (_timeSinceLastSync.elapsed() / 1000) << "s)";
|
qDebug() << "* Polling" << alias() << "for changes. (time since last sync:" << (_timeSinceLastSync.elapsed() / 1000) << "s)";
|
||||||
|
|
||||||
if (_paused || AccountManager::instance()->account()->state() != Account::Connected) {
|
|
||||||
qDebug() << "Not syncing. :" << _paused << AccountManager::instance()->account()->state();
|
Account *account = AccountManager::instance()->account();
|
||||||
|
|
||||||
|
if (!account) {
|
||||||
|
qDebug() << Q_FUNC_INFO << "No valid account object";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_paused || account->state() != Account::Connected) {
|
||||||
|
qDebug() << "Not syncing. :" << _paused << account->state();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,8 +273,8 @@ void Folder::slotPollTimerTimeout()
|
||||||
qDebug() << "** Force Sync now, state is " << _syncResult.statusString();
|
qDebug() << "** Force Sync now, state is " << _syncResult.statusString();
|
||||||
emit scheduleToSync(alias());
|
emit scheduleToSync(alias());
|
||||||
} else {
|
} else {
|
||||||
// do the ordinary etag chech for the root folder.
|
// do the ordinary etag check for the root folder.
|
||||||
RequestEtagJob* job = new RequestEtagJob(AccountManager::instance()->account(), remotePath(), this);
|
RequestEtagJob* job = new RequestEtagJob(account, remotePath(), this);
|
||||||
// check if the etag is different
|
// check if the etag is different
|
||||||
QObject::connect(job, SIGNAL(etagRetreived(QString)), this, SLOT(etagRetreived(QString)));
|
QObject::connect(job, SIGNAL(etagRetreived(QString)), this, SLOT(etagRetreived(QString)));
|
||||||
QObject::connect(job, SIGNAL(networkError(QNetworkReply*)), this, SLOT(slotNetworkUnavailable()));
|
QObject::connect(job, SIGNAL(networkError(QNetworkReply*)), this, SLOT(slotNetworkUnavailable()));
|
||||||
|
|
Loading…
Reference in a new issue