-
Notifications
You must be signed in to change notification settings - Fork 123
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
Graph<T>::removeNode has potential to throw due to optional being accessed early #418
Comments
Hi, I would like to have a crack at this issue. I'm pretty new to the open source world, and this would be my first contribution. I am currently reading through the documentation and contribution guidelines. Thank you for your patience :) |
@Ajay-26 Thanks! Go for it! |
Hi @nolankramer, I just made a PR from my branch to the head of the repo. I see that the test for Labeler / triage (pull_request_target) has failed, but I can't make much sense of the feedback from the test. I'm trying to fix that before I complete my PR, could you guide me on how to do it ? I can retract this PR and work on those changes. |
@Ajay-26 No need to retract the PR. It seems like an unrelated issue. Feel free to ignore it. |
I've added some feedback on the PR to point you in the right direction :) |
… optional being accessed early (#430) * optional should first check whether the node indeed exists * fixed typo in impl and also added test for removing node that was never added * incorporated review into PR * resolved use after free for map iterator * reformatted code as per PR feedback * reformatted code as per PR feedback
The implementation that added isolated nodes seems to be assuming that
nodeOpt
will always have a value. This is untrue if the node does not exist:nodeOpt.value()
is called before verifying the optional has something in it.This should be updated to something like this:
The tests should also be updated to test the case where we try to remove a node that does not exist in the graph.
The text was updated successfully, but these errors were encountered: