Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2022-01-12 14:14:32 +0300
committerHannah von Reth <vonreth@kde.org>2022-01-18 14:58:03 +0300
commit269aa3253c0abf3d44acd244363d963c6c2ea77e (patch)
treefdf1bca92a7ac0dd95dc95a0cc469d57419090e0 /src/gui/folderwatcher.cpp
parent5d97e1cb9cc92e664b7c8adf76039f261b5d7ac9 (diff)
Don't try to open empty file name
Fixes: `QFSFileEngine::open: No file name specified`
Diffstat (limited to 'src/gui/folderwatcher.cpp')
-rw-r--r--src/gui/folderwatcher.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/gui/folderwatcher.cpp b/src/gui/folderwatcher.cpp
index a307cca20..c6cef4ff6 100644
--- a/src/gui/folderwatcher.cpp
+++ b/src/gui/folderwatcher.cpp
@@ -83,7 +83,8 @@ void FolderWatcher::startNotificatonTest(const QString &path)
return;
#endif
- OC_ASSERT(_testNotificationPath.isEmpty());
+ Q_ASSERT(_testNotificationPath.isEmpty());
+ Q_ASSERT(!path.isEmpty());
_testNotificationPath = path;
// Don't do the local file modification immediately:
@@ -93,17 +94,20 @@ void FolderWatcher::startNotificatonTest(const QString &path)
void FolderWatcher::startNotificationTestWhenReady()
{
+ if (!_testNotificationPath.isEmpty()) {
+ // we already received the notification
+ return;
+ }
if (!_d->_ready) {
QTimer::singleShot(1000, this, &FolderWatcher::startNotificationTestWhenReady);
return;
}
- auto path = _testNotificationPath;
- if (QFile::exists(path)) {
- auto mtime = FileSystem::getModTime(path);
- FileSystem::setModTime(path, mtime + 1);
+ if (OC_ENSURE(QFile::exists(_testNotificationPath))) {
+ const auto mtime = FileSystem::getModTime(_testNotificationPath);
+ FileSystem::setModTime(_testNotificationPath, mtime + 1);
} else {
- QFile f(path);
+ QFile f(_testNotificationPath);
f.open(QIODevice::WriteOnly | QIODevice::Append);
}