From ef06be63bfd3c1a0751db094ce586e3d4fa31cda Mon Sep 17 00:00:00 2001 From: Vladimir Golovnev Date: Mon, 20 Nov 2023 20:37:55 +0300 Subject: [PATCH] Remove incorrect assertions PR #19964. --- src/base/bittorrent/torrentimpl.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/base/bittorrent/torrentimpl.cpp b/src/base/bittorrent/torrentimpl.cpp index 6c19491b7..323a934a5 100644 --- a/src/base/bittorrent/torrentimpl.cpp +++ b/src/base/bittorrent/torrentimpl.cpp @@ -2172,20 +2172,20 @@ void TorrentImpl::handleFileRenamedAlert(const lt::file_renamed_alert *p) const Path newActualParentPath = newActualFilePath.parentPath(); if (newActualParentPath.filename() == UNWANTED_FOLDER_NAME) { - Q_ASSERT(oldActualParentPath.filename() != UNWANTED_FOLDER_NAME); - + if (oldActualParentPath.filename() != UNWANTED_FOLDER_NAME) + { #ifdef Q_OS_WIN - const std::wstring winPath = (actualStorageLocation() / newActualParentPath).toString().toStdWString(); - const DWORD dwAttrs = ::GetFileAttributesW(winPath.c_str()); - ::SetFileAttributesW(winPath.c_str(), (dwAttrs | FILE_ATTRIBUTE_HIDDEN)); + const std::wstring winPath = (actualStorageLocation() / newActualParentPath).toString().toStdWString(); + const DWORD dwAttrs = ::GetFileAttributesW(winPath.c_str()); + ::SetFileAttributesW(winPath.c_str(), (dwAttrs | FILE_ATTRIBUTE_HIDDEN)); #endif + } } #ifdef QBT_USES_LIBTORRENT2 else if (oldActualParentPath.filename() == UNWANTED_FOLDER_NAME) { - Q_ASSERT(newActualParentPath.filename() != UNWANTED_FOLDER_NAME); - - Utils::Fs::rmdir(actualStorageLocation() / oldActualParentPath); + if (newActualParentPath.filename() != UNWANTED_FOLDER_NAME) + Utils::Fs::rmdir(actualStorageLocation() / oldActualParentPath); } #else else