mirror of https://gitee.com/bigwinds/arangodb
Fix error handling in case ClusterCommResult.result == nullptr (#7356)
This commit is contained in:
parent
21c832248c
commit
0d5f85e684
|
@ -362,13 +362,22 @@ static arangodb::Result cancelBarrier(
|
|||
DB + database + REPL_BARRIER_API + std::to_string(barrierId), std::string(),
|
||||
std::unordered_map<std::string, std::string>(), timeout);
|
||||
|
||||
// I'm sure that syncRequest cannot return null. But the check doesn't hurt
|
||||
// and is preferable over a segfault.
|
||||
TRI_ASSERT(comres != nullptr);
|
||||
if (comres == nullptr) {
|
||||
LOG_TOPIC(ERR, Logger::MAINTENANCE)
|
||||
<< "CancelBarrier: error: syncRequest returned null";
|
||||
return arangodb::Result{TRI_ERROR_INTERNAL};
|
||||
}
|
||||
|
||||
if (comres->status == CL_COMM_SENT) {
|
||||
auto result = comres->result;
|
||||
if (result != nullptr && result->getHttpReturnCode() != 200 &&
|
||||
result->getHttpReturnCode() != 204) {
|
||||
auto errorMessage = comres->stringifyErrorMessage();
|
||||
if (result == nullptr || (result->getHttpReturnCode() != 200 &&
|
||||
result->getHttpReturnCode() != 204)) {
|
||||
std::string errorMessage = comres->stringifyErrorMessage();
|
||||
LOG_TOPIC(ERR, Logger::MAINTENANCE)
|
||||
<< "CancelBarrier: error" << errorMessage;
|
||||
<< "CancelBarrier: error" << errorMessage;
|
||||
return arangodb::Result(TRI_ERROR_INTERNAL, errorMessage);
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue