fix(modulo-controllers): correctly handle nullptr #118
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The original intention for this branch/PR was to investigate seg faults that would occur when running apps. Along with some issues in the way I was packaging (unrelated to this PR, but related to the seg faults I was seeing), we found a small issue in the way a failed dynamic_pointer_cast would be handled (i.e., it doesn't throw an exception, but returns nullptr).
There also seems to be some sort of issue where we get an EncodedState exception that is followed by a segmentation fault. I can't quite see a reason. We moved the second dereference of the message from
readFromNonRTto potentially prevent this issue (in the case of some sync problem between first and second dereference). Despite this not being very likely, and also not being fully safe, it doesn't hurt to do this in one line.This PR solves the issue by correctly handling a failed dynamic_pointer_cast.
Review guidelines
Estimated Time of Review: 3 minutes
Checklist before merging: