gracefully handle one case of invalid handles
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Mon, 22 Nov 2021 12:27:00 +0000 (13:27 +0100)
committerMatthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr>
Tue, 23 Nov 2021 13:41:29 +0000 (13:41 +0000)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/libsync/vfs/cfapi/vfs_cfapi.cpp

index 76e3c446d53cd5f75502f82a8c74d4dd1ea1fbee..1adeb5d686b8537a297eb978f56500cc9b8b723f 100644 (file)
@@ -160,6 +160,9 @@ Result<Vfs::ConvertToPlaceholderResult, QString> VfsCfApi::convertToPlaceholder(
     const auto replacesPath = QDir::toNativeSeparators(replacesFile);
 
     const auto handle = cfapi::handleForPath(localPath);
+    if (!handle) {
+        return { "Invalid handle for path " + localPath };
+    }
     if (cfapi::findPlaceholderInfo(handle)) {
         return cfapi::updatePlaceholderInfo(handle, item._modtime, item._size, item._fileId, replacesPath);
     } else {