Skip to content

Commit

Permalink
Add check if an operation was cancelled
Browse files Browse the repository at this point in the history
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 <ext-yevhenii.dudnyk@here.com>
  • Loading branch information
dudnyk committed Jun 10, 2022
1 parent e0ba039 commit e16e864
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions olp-cpp-sdk-dataservice-read/src/DownloadItemsJob.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class DownloadItemsJob {
user_callback_) {
auto user_callback = std::move(user_callback_);
if (user_callback) {
user_callback({{client::ErrorCode::Cancelled, "Cancelled"}});
user_callback(client::ApiError::Cancelled());
}
return;
}
Expand All @@ -105,7 +105,7 @@ class DownloadItemsJob {
GetAccumulatedBytes(accumulated_statistics_)});
}

if (!--download_task_count_) {
if (!--download_task_count_ && user_callback_) {
OLP_SDK_LOG_DEBUG_F("DownloadItemsJob",
"Download complete, succeeded=%zu, failed=%zu",
requests_succeeded_, requests_failed_);
Expand Down

0 comments on commit e16e864

Please sign in to comment.