Fixed error spam and a memory leak

This commit is contained in:
WolverinDEV 2021-05-03 10:42:03 +02:00
parent c7985c4dd1
commit f48b904935

View File

@ -253,6 +253,12 @@ namespace ts {
[[nodiscard]] inline bool has_error() const { [[nodiscard]] inline bool has_error() const {
switch (this->type()) { switch (this->type()) {
case command_result_type::bulked: case command_result_type::bulked:
for(const auto& bulk : *this->bulks()) {
if(bulk.has_error()) {
return true;
}
}
return false; return false;
case command_result_type::error: case command_result_type::error:
return this->error_code() != error::ok; return this->error_code() != error::ok;
@ -320,6 +326,9 @@ namespace ts {
auto type = this->type(); auto type = this->type();
if(type == command_result_type::bulked) { if(type == command_result_type::bulked) {
auto bulks = this->bulks(); auto bulks = this->bulks();
for(auto& bulk : *bulks) {
bulk.release_data();
}
delete bulks; delete bulks;
} else if(type == command_result_type::detailed) { } else if(type == command_result_type::detailed) {
auto details = this->details(); auto details = this->details();