fix crash when cancelling download

This commit is contained in:
Lion Kortlepel 2024-09-22 20:20:31 +02:00
parent 007cd6573e
commit 1260515a40
No known key found for this signature in database
GPG Key ID: 4322FF2B4C71259B

View File

@ -214,6 +214,8 @@ std::vector<char> MultiDownload(SOCKET MSock, SOCKET DSock, uint64_t Size, const
if (MData.empty()) {
MultiKill(MSock, DSock);
Terminate = true;
Au.join();
return {};
}
@ -221,6 +223,8 @@ std::vector<char> MultiDownload(SOCKET MSock, SOCKET DSock, uint64_t Size, const
if (DData.empty()) {
MultiKill(MSock, DSock);
Terminate = true;
Au.join();
return {};
}
@ -228,6 +232,8 @@ std::vector<char> MultiDownload(SOCKET MSock, SOCKET DSock, uint64_t Size, const
GRcv = MData.size() + DData.size();
if (GRcv != Size) {
error("Something went wrong during download; didn't get enough data. Expected " + std::to_string(Size) + " bytes, got " + std::to_string(GRcv) + " bytes instead");
Terminate = true;
Au.join();
return {};
}