We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Application crashes. Steps to reproduce:
HttpServer::methodGet
base::JSONSerializer::checkAddComma
_json
_json.back()
std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&]: Assertion '!empty()' failed.
The text was updated successfully, but these errors were encountered:
Possible fix:
diff --git a/src/base/JSONSerializer.h b/src/base/JSONSerializer.h index 5c88ca3..1bacce7 100644 --- a/src/base/JSONSerializer.h +++ b/src/base/JSONSerializer.h @@ -100,10 +100,12 @@ namespace base { private: void checkAddComma() { - const char c = _json.back(); - if (c == '\"' || c == '}' || c == ']' || std::isdigit(c)) { - _json += ", "; - } + if(!_json.empty()) { + const char c = _json.back(); + if (c == '\"' || c == '}' || c == ']' || std::isdigit(c)) { + _json += ", "; + } + } } std::string makeJSONString(const std::string &msg) {
Sorry, something went wrong.
No branches or pull requests
Application crashes. Steps to reproduce:
HttpServer::methodGet
file = "log.json"base::JSONSerializer::checkAddComma
string_json
is empty_json.back()
is crashing ("Assertion '!empty()' failed."):std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::reference std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::back() [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; reference = char&]: Assertion '!empty()' failed.
The text was updated successfully, but these errors were encountered: