fix the bug of send "null" in request body causes seg-fault on any endpoint w/ BODY_DTO

This commit is contained in:
linhaojun857 2023-12-15 23:20:09 +08:00
parent 57e6a714d7
commit df9ddc0313

View File

@ -126,7 +126,7 @@ public:
auto type = Wrapper::Class::getType();
oatpp::parser::Caret caret(str);
auto result = read(caret, type).template cast<Wrapper>();
if(result == nullptr) {
if(caret.hasError()) {
throw oatpp::parser::ParsingError(caret.getErrorMessage(), caret.getErrorCode(), caret.getPosition());
}
return result;