-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
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
Segmentation fault when parsing invalid json file #633
Comments
This is expected behavior in case of parse errors. The description of the exception includes a description of the error message and (in case of the In #623, several issues are linked that deal with a no-throw version of the parser, but this is not finished yet. |
Is there a fast way to fix this on my side? Cause i need ability to continue app working if json file is invalid. There is no any exception thrown
gives nothing for me |
You can catch the exception. Something like: std::ifstream file("test.json");
nlohmann::json root;
try {
file >> root
} catch (...) {
std::cerr << "error parsing file" << std::endl;
} |
seems there was some issue with boost::format with e.what() in my catch block, closing issue.
this had some crash, e - exception from your json lib |
Thanks for checking back. It's strange that there may be an issue with boost::format. |
forgetting, for example comma, in json file gives:
Segmentation fault (core dumped)
gcc 6.3.0 ubuntu 14.04
I'm expecting it will throw
std::exception
The text was updated successfully, but these errors were encountered: