зеркало из https://github.com/nextcloud/desktop.git
prevent crash in Accont::davPath without credentials
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
This commit is contained in:
Родитель
9808f83913
Коммит
391935c90f
|
@ -99,7 +99,7 @@ AccountPtr Account::sharedFromThis()
|
|||
|
||||
QString Account::davUser() const
|
||||
{
|
||||
return _davUser.isEmpty() ? _credentials->user() : _davUser;
|
||||
return _davUser.isEmpty() && _credentials ? _credentials->user() : _davUser;
|
||||
}
|
||||
|
||||
void Account::setDavUser(const QString &newDavUser)
|
||||
|
|
|
@ -75,6 +75,7 @@ endif()
|
|||
|
||||
nextcloud_add_benchmark(LargeSync)
|
||||
|
||||
nextcloud_add_test(Account)
|
||||
nextcloud_add_test(FolderMan)
|
||||
nextcloud_add_test(RemoteWipe)
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* This software is in the public domain, furnished "as is", without technical
|
||||
* support, and with no warranty, express or implied, as to its usefulness for
|
||||
* any purpose.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <qglobal.h>
|
||||
#include <QTemporaryDir>
|
||||
#include <QtTest>
|
||||
|
||||
#include "common/utility.h"
|
||||
#include "folderman.h"
|
||||
#include "account.h"
|
||||
#include "accountstate.h"
|
||||
#include "configfile.h"
|
||||
#include "testhelper.h"
|
||||
|
||||
using namespace OCC;
|
||||
|
||||
class TestAccount: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
private slots:
|
||||
void testDavPathCrash()
|
||||
{
|
||||
AccountPtr account = Account::create();
|
||||
account->davPath();
|
||||
}
|
||||
};
|
||||
|
||||
QTEST_APPLESS_MAIN(TestAccount)
|
||||
#include "testaccount.moc"
|
Загрузка…
Ссылка в новой задаче