Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions src/future.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ const CassResult* cass_future_get_result(CassFuture* future) {

if (result) {
result->decode_first_row();
result->inc_ref();
}

result->inc_ref();

return CassResult::to(result.get());
}

Expand All @@ -82,7 +81,7 @@ const CassPrepared* cass_future_get_prepared(CassFuture* future) {
if (result && result->kind() == CASS_RESULT_KIND_PREPARED) {
cass::Prepared* prepared =
new cass::Prepared(result, response_future->statement, response_future->schema_metadata);
prepared->inc_ref();
if (prepared) prepared->inc_ref();
return CassPrepared::to(prepared);
}
return NULL;
Expand All @@ -98,7 +97,7 @@ const CassErrorResult* cass_future_get_error_result(CassFuture* future) {
if (!response_future->is_error()) return NULL;

cass::SharedRefPtr<cass::ErrorResponse> error_result(response_future->response());
error_result->inc_ref();
if (error_result) error_result->inc_ref();
return CassErrorResult::to(error_result.get());
}

Expand Down Expand Up @@ -145,17 +144,20 @@ CassError cass_future_custom_payload_item(CassFuture* future,
}
cass::SharedRefPtr<cass::Response> response(
static_cast<cass::ResponseFuture*>(future->from())->response());
const cass::Response::CustomPayloadVec& custom_payload
= response->custom_payload();
if (index >= custom_payload.size()) {
return CASS_ERROR_LIB_INDEX_OUT_OF_BOUNDS;
if (response) {
const cass::Response::CustomPayloadVec& custom_payload =
response->custom_payload();
if (index >= custom_payload.size()) {
return CASS_ERROR_LIB_INDEX_OUT_OF_BOUNDS;
}
const cass::Response::CustomPayloadItem& item = custom_payload[index];
*name = item.name.data();
*name_length = item.name.size();
*value = reinterpret_cast<const cass_byte_t*>(item.value.data());
*value_size = item.value.size();
return CASS_OK;
}
const cass::Response::CustomPayloadItem& item = custom_payload[index];
*name = item.name.data();
*name_length = item.name.size();
*value = reinterpret_cast<const cass_byte_t*>(item.value.data());
*value_size = item.value.size();
return CASS_OK;
return CASS_ERROR_LIB_INTERNAL_ERROR;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about creating a new error for this? I skimmed over the existing errors codes and couldn't find one that fits this type of error. I'm thinking something like 'CASS_ERROR_LIB_RESPONSE_NOT_AVAILABLE`.

}

} // extern "C"
Expand Down