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 for a 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 0cfc7f4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 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 @@ -115,8 +115,10 @@ class DownloadItemsJob {
}

void OnPrefetchCompleted(Response<PrefetchResult> result) {
auto prefetch_callback = std::move(user_callback_);
prefetch_callback(std::move(result));
if (user_callback_) {
auto prefetch_callback = std::move(user_callback_);
prefetch_callback(std::move(result));
}
}

private:
Expand Down

0 comments on commit 0cfc7f4

Please sign in to comment.