-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
Fix example-chat #743
base: master
Are you sure you want to change the base?
Fix example-chat #743
Conversation
What is the exact error? As far as I see in the code, these handlers are checked for null before calling them. Maybe problem is with example? |
The application crashes, segfaults. I ran it on Android 15 under Termux (clang) and Linux (probably clang again) where it crashed. Using gdb, the crash is caused by assigning null to a std::function. The crash can be reproduced on Lunux by compiling with clang and just using example-chat, the faulty code is in Crow, not the example. The check for null isn't the problem, it's assigning null that's the problem. |
Ok, thanks for info. So the only thing is that you can create lambda_wrapper with nullptr. |
ReturnType operator()(Args... args) const | ||
{ | ||
if (valid_) | ||
{ | ||
return func_(args...); | ||
} | ||
throw call_error(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand what lambda_wrapper does 🙂 After all, std just throws as well
https://en.cppreference.com/w/cpp/utility/functional/function/operator()
Exceptions
Throws std::bad_function_call if *this does not store a callable function target, i.e. !*this == true.
I have encountered the same problem and don't know how to fix it yet.
|
example-chat has runtime errors because std::function<> is assigned null in places.
This is a fix for that, with unittests.