Skip to content

Commit 6ae2ab2

Browse files
authored
Add check if an operation was cancelled (#1338)
Add check if the pointer exists to prevent calling OnPrefetchCompletedin in case an operation is cancelled. Relates-To: OLPEDGE-2746 Signed-off-by: Yevhenii Dudnyk <[email protected]>
1 parent e0ba039 commit 6ae2ab2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

olp-cpp-sdk-dataservice-read/src/DownloadItemsJob.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ class DownloadItemsJob {
8989
user_callback_) {
9090
auto user_callback = std::move(user_callback_);
9191
if (user_callback) {
92-
user_callback({{client::ErrorCode::Cancelled, "Cancelled"}});
92+
user_callback(client::ApiError::Cancelled());
9393
}
9494
return;
9595
}
@@ -105,7 +105,7 @@ class DownloadItemsJob {
105105
GetAccumulatedBytes(accumulated_statistics_)});
106106
}
107107

108-
if (!--download_task_count_) {
108+
if (!--download_task_count_ && user_callback_) {
109109
OLP_SDK_LOG_DEBUG_F("DownloadItemsJob",
110110
"Download complete, succeeded=%zu, failed=%zu",
111111
requests_succeeded_, requests_failed_);

0 commit comments

Comments
 (0)